I already felt the need for using names like 'warning', 'success',
etc. but currently if I use setFlash like this then I wouldn't be able
to have more than one warning message in a given request, for example.

I'm working on a patch to the Session class that would modify
setFlash's signature to accept another parameter called $type, which
would make it look like:

public function setFlash($type, $name, $value)

As such, instead of using something like:

$this['session']->setFlash('doctrine_user_group_create/success',
'group_create_success');

We would use it like this:

$this['session']->setFlash('success', 'doctrine_user_group_create/
success', 'group_create_success');

This change would be really handy if you have for example a slot in a
template that shows all your application 'error' and 'warning' type
flashes in a given request.

What do you think?

On 18 nov, 12:06, Henrik Bjornskov <[email protected]> wrote:
> My opinion is that the key for flashes should be consistent because
> most of the time you would want thoose flashes to be shown at the top
> of you layout or something.
>
> so $this->get('session')->setFlash('success', '_W_content');
>
> On 22 Okt., 09:00, Lukas Kahwe Smith <[email protected]> wrote:
>
>
>
> > Hi,
>
> > During the work on twigyfing DoctrineUserBundle we stumbled over another 
> > thing that made us 
> > wonder:http://github.com/liip/DoctrineUserBundle/blob/master/Resources/views...
>
> > {% if _view.session.hasFlash('doctrine_user_user_create/success') %}
> > <div class="doctrine_user_user_create_success">
> >     {% trans 'The user has been created successfully' from 
> > DoctrineUserBundle %}
> > </div>
> > {% endif %}
>
> > The flash messages are actually just keys with true:
> > $this['session']->setFlash('doctrine_user_group_create/success', true);
>
> > I can see how this makes sense in the way that it keeps text out of the 
> > controllers. Then again the question is if it makes sense to have actual 
> > text anyway rather than simply a unique key to use for the look up in the 
> > translation system. That way it is easier to also just have some generic 
> > handler for flash messages that is placed into the layout template.
>
> > regards,
> > Lukas Kahwe Smith
> > [email protected]

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to