2010年1月10日星期日

Re: [fw-mvc] Flash Messenger and getCurrentMessages()?

getCurrentMessages() is needed when you're using the FlashMessenger but perhaps aren't redirecting before displaying them. 

The obvious case for this is when you have a create or update action that displays a form and you which to use the FlashMessenger to announce that there are errors. (I'm imagining that on a successful form submission you would redirect to a "view" action showing the newly created/modified item, and a Flash Message indicating success.)

If it's any use to you I wrote a blog article about this and wrote a view helper that encapsulates all the _wiggles_ here:


HTH.

Regards,
Carlton 


On 9 Jan 2010, at 00:41, Hector Virgen wrote:

I was looking at that, too, but neither one of them accepts any arguments (according to the API docs).

Looking through the code, it seems that getMessages() pulls from the self::$_messages array, while get getCurrentMessages() pulls from the actual session. They both pull from the current namespace.

The word "specific" is what through me off.

--
Hector


On Fri, Jan 8, 2010 at 4:32 PM, Shaun Farrell <farrelley@gmail.com> wrote:
Has to do with the namespace

getCurrentMessages() - get messages that have been added to the current namespace within this request
getMessages() - Get messages from a specific namespace

Shaun J. Farrell
Washington, DC
(202) 713-5241
www.farrelley.com



On Fri, Jan 8, 2010 at 7:26 PM, Hector Virgen <djvirgen@gmail.com> wrote:
Quick question: What is the difference between getMessages() and getCurrentMessages()? Thanks!

--
Hector



没有评论: