[Solar-talk] Forwarding Controller notes

Rodrigo Moraes rodrigo.moraes at gmail.com
Thu Oct 19 06:08:44 PDT 2006


Matt,
Here are the first notes / suggestions for the Forwarding controller:

- to follow Solar/Pear naming conventions for methods and action names
in Solar_App (allowing existing apps to work with the controller),
rename action methods to actionName(), instead of do_name().

------------------------------

- a front controller can be added to call the "root" controller,
following some configs. a display method can be added to render the
page, and the handleRequest() method can be renamed to fetch() so
existing apps will also work with the forwarding controller. So, this:

    $root = Solar::factory('Goodie_Controller_Root');
    echo $root->handleRequest();

... would be executed like in Solar:

    $front = Solar::factory('Goodie_Controller_Front');
    $front->display();

With this method name changes, I got the bookmarks app working by
mapping 'bookmarks' to 'Solar_App_Bookmarks'. The example
Goodie_Controller_Root would be an app main controller
(Goodie_App_Root), which is defined in the front controller
configuration. I hope this makes sense.

------------------------------

- I've added a property $_action_default to
Goodie_Controller_Forwarding, which can be overridden by the child
controllers. It has the obvious purpose to define a default action if
no one is set or found. The advantage is that you can map controllers
more easily in some cases:

'shop' => array('Tipos_App_Shop')

... but also that the controller defines its default action, so other
controllers can left this decision for it if no specific action should
be called. In this case you only have to change the default action in
one place.

------------------------------

I volunteer to improve / format phpdocs in the class, if you want.
Wonderful controller. :)

cheers,
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