Simon Corless wrote:
> 
> 
> 
> netlynx wrote:
>> 
>> The question that came to mind is Rob is checking for an identity in the
>> preDispatch() method of the action controller --
>> Zend_Auth::getInstance()->hasIdentity() --, and I am wondering if this
>> wouldn’t be better located in the init() method of the action controller?
>> 
>> I guess what it really comes down to is without poking through the Zend
>> Framework source code and api documentation too much, what ‘order’ does
>> things happen in, and what are the best practices of what should go into
>> the different methods.  Is there some kind of quick descriptions or maybe
>> an application flow diagram of some sort that has been put together
>> showing this?
>> 
> 
> I would personally put this in a plugin so that you didn't have to mess
> with your actions, that way the site and feature should work whether you
> have auth or not (i.e. as different situations may arise).
> 
> It's specified in the manual under plugins and controllers (I believe) as
> to what order the calls are made, but also someone did a chart the other
> day which is here: 
> 
> http://www.nabble.com/Graph-showing-Action-Helpers,-Plugins-and-Controllers-lifecycle-along-dispatch-td20304504.html#a20613357
> 
> Or directly:
> 
> http://surlandia.com/2008/11/03/zend-framework-plugins-action-helpers-and-controllers-life-cycle-during-dispatch/
> 
> Which I think you will find very useful.
> 
> Simon
> 

That is definitely helpful thank you.  I hadn't even thought of creating a
plugin (mainly because I completely skipped the whole section on controllers
and plugins).  I kinda stopped at the point in that section of extending the
action controller (which also works -- from a kind of preDispatch hook kind
of sense, I was putting anything 'global' to action controllers into the
init() and preDispatch() methods of the extended class).  I'm going to do
some more reading! :)  The chart as well was good, I am wondering if there
is a more detailed chart that provided a complete Zend Framework application
lifecycle, indicating what sorts of things would generally be placed in each
phase of the lifecycle.

I hope I am making sense in my question?  I am going to start separating my
auth and acl stuff from the action controllers here, wish me luck in not
breaking everything :)

Thanks
Aaron

-- 
View this message in context: 
http://www.nabble.com/Best-Practices-Question-tp20805394p20817465.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to