Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update controller.rst clarifying automatic deletion for flash messages #5640

Closed
wants to merge 1 commit into from

Conversation

miguelvilata
Copy link
Contributor

Hello.

It's neccesary clarify that flash messages aren't removed automatically when next session comes. They are removed because the use of get() method in FlashBag object. If you use peek() method, or simply don't show stored messages they remain in session.

Show get() method in Symfony\Component\HttpFoundation\Session\Flash\FlashBag:

/**
 * {@inheritdoc}
 */
public function get($type, array $default = array())
{
    if (!$this->has($type)) {
        return $default;
    }

    $return = $this->flashes[$type];

    unset($this->flashes[$type]);

    return $return;
}

@@ -619,8 +619,7 @@ session.
Flash Messages
~~~~~~~~~~~~~~

You can also store small messages that will be stored on the user's session
for exactly one additional request. This is useful when processing a form:
You can also store small messages that will be stored on the user's session. This is useful when processing a form:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please revert this change? We wrap lines after the first word that crosses the 72nd character mark.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. But what do you think about removing or modify "for exactly one additional request" sentence?. Do you think adding the tip about get()/peek() will be enough without modifiying this sentence?.

You can also store small messages that will be stored on the user's session
for exactly one additional request. This is useful when processing a form:
You can also store small messages that will be stored on the user's session.
This is useful when processing a form:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like something went wrong here (this doesn't match the following line)

@xabbuh
Copy link
Member

xabbuh commented Sep 2, 2015

Hey @miguelvilata, can you make the change? :)

Hello.

It's neccesary clarify that flash messages aren't removed automatically when next session comes. They are removed because the use of  get method in FlashBag object. If you use peek() method, or simply don't show stored messages they remain in session.

Show get() method in Symfony\Component\HttpFoundation\Session\Flash\FlashBag:

    /**
     * {@inheritdoc}
     */
    public function get($type, array $default = array())
    {
        if (!$this->has($type)) {
            return $default;
        }

        $return = $this->flashes[$type];

        unset($this->flashes[$type]);

        return $return;
    }
@miguelvilata
Copy link
Contributor Author

It's my firs contribution to documentation. It is neccesary doing something more here?. Thanks.

@xabbuh
Copy link
Member

xabbuh commented Sep 23, 2015

👍 looks great

xabbuh added a commit that referenced this pull request Oct 3, 2015
…lash messages (miguelvilata)

This PR was submitted for the 2.7 branch but it was merged into the 2.3 branch instead (closes #5640).

Discussion
----------

Update controller.rst clarifying automatic deletion for flash messages

Hello.

It's neccesary clarify that flash messages aren't removed automatically when next session comes. They are removed because the use of  get() method in FlashBag object. If you use peek() method, or simply don't show stored messages they remain in session.

Show get() method in Symfony\Component\HttpFoundation\Session\Flash\FlashBag:

    /**
     * {@inheritdoc}
     */
    public function get($type, array $default = array())
    {
        if (!$this->has($type)) {
            return $default;
        }

        $return = $this->flashes[$type];

        unset($this->flashes[$type]);

        return $return;
    }

Commits
-------

e6556b5 Update controller.rst
xabbuh added a commit that referenced this pull request Oct 3, 2015
Replace tip by note and fix API doc reference.
@xabbuh
Copy link
Member

xabbuh commented Oct 3, 2015

Thank you @miguelvilata. I have merged your changes into the 2.3 branch (that's why your pull request is displayed as closed) and made some minor tweaks in 917e6ca.

@xabbuh xabbuh closed this Oct 3, 2015
@miguelvilata
Copy link
Contributor Author

Thank you for your help.


Miguel Vilata
@miguelvilata
miguel.vilata@gmail.com wchemi@gmail.com

2015-10-03 11:25 GMT+02:00 Christian Flothmann notifications@github.com:

Thank you @miguelvilata https://github.com/miguelvilata. I have merged
your changes into the 2.3 branch (that's why your pull request is
displayed as closed) and made some minor tweaks in 917e6ca
917e6ca
.


Reply to this email directly or view it on GitHub
#5640 (comment)
.

@xabbuh
Copy link
Member

xabbuh commented Oct 3, 2015

You're welcome. Hope to see you back soon with more changes. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants