Coming from Zend_Framework, I wasn't content with their approach, so I built the following setup:
I have a Message containing a "template", an optional translator and additional arbitrary properties. It implements ArrayAccess to make the properties easily accessible. It also implements __toString in order to render the message. When rendering the "template" will be translated if wished, and afterwards any %property% notations will be replaced with the value of that property. I also have a MessageList, it contains Messages ;) It extends ArrayObject for easy usage. Messages are added with a method add( string $template, string $type, array $properties ), which forces a Message to have a type. Internally this type is just another property. There are methods like hasProperty( string|array $property, mixed $value = null ), getByProperty( string|array $property, mixed $value = null ), clearByProperty( string|array $property, mixed $value = null ) and more... When passed only (a) property/ies it will filter Messages containing that/ose property/ies whatever the value might be. When passed (a) property/ies and (a) value(s) it will also match the value(s) of that/ose property/ies. And this is the real strength of this message system. You can easily filter and order by type, but also by any other property. Some examples are dividing the messages by type to display them in a box with an appropriate color. Or include form-names in order to render validation-messages next to the input-field they address. Or if you divided a form into several sections, group and display the messages above each section. You can also remove or replace messages based on some property. Or easily alter a property before rendering. I've developed the Message and MessageList about 2 years ago, and are still happily using them now :) -- 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 symfony-devs@googlegroups.com To unsubscribe from this group, send email to symfony-devs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-devs?hl=en