[Solar-talk] multiple controllers, one view
Rodrigo Moraes
rodrigo.moraes at gmail.com
Sat Oct 21 09:52:24 PDT 2006
Hi,
I would like to ask your opinion about how to tie controllers and
views. I've been working with the "forwarding" controller and it
passes the request ahead to the next controller, until the last
controller handles the request. So we end up with a bunch of
controllers (two or three, in most cases), and all of them are a
subclass of Forwarding_Controller.
How to have an unique view for all these controllers? I see two options:
1. Instantiate the view on the first controller and store the view in
a property. After each controller is created, the same view is
assigned to it.
2. Register the view, and call it from registry when needed (this is
intended to be used by Controller_Forwarding, not everywhere).
I'm using the second option. Having a lot of "front"/"page"
controllers are forcing me to use the registry perhaps more than I
should: I'm storing Solar_View, Solar_Session, Solar_Request and
Solar_Uri_Action instances in the registry. This avoids having to pass
around objects to ensure they will be the same, or to create objects
repeatedly. Is it bad to use the registry in these cases?
Which approach would you prefer? Any other options?
thanks,
rodrigo
---------------------------------------------------------------------
Solar has now a Community Wiki: solarphp.org
---------------------------------------------------------------------
Join the #solarphp IRC channel on freenode.org
---------------------------------------------------------------------
More information about the solar-talk
mailing list