multi action controller

0 views
Skip to first unread message

Beau Simensen

unread,
Oct 15, 2010, 2:41:22 PM10/15/10
to halo-php
I'll start working on the multi action controller implementation sometime soon. Aek, have you ever used gist? If you could, I would appreciate it if you could post your current multi action controller implementation in gist. Maybe one gist per file if it relies on multiple files (tweaks to other classes). Or you can put them all in one gist if you prefer.

Gist is great. It is free and provides really nice syntax highlighting. Just make sure to choose PHP as the language so it highlights correctly. :)

Example would be this:


Posting source snippets much longer than maybe 10-15 lines in this group makes for some difficult reading, especially if the lines are very long. It will be much easier to follow your code if I can refer to it in this way instead of in an old email thread. I'll try to do the same where possible.

Thanks!


--

Beau D. Simensen


Dragonfly Development Inc
http://dflydev.com/

aek

unread,
Oct 18, 2010, 12:51:31 PM10/18/10
to Halo General Discussion
Hi Beau , Im back.
The halo_MultiactionController was updated and uploaded to gist. There
is a fix in the bind method to support nested properties. The nested
properties only work if a property is initialized as an object.

It can be found here: http://gist.github.com/632545

Beau Simensen

unread,
Oct 18, 2010, 1:11:33 PM10/18/10
to halo...@googlegroups.com
Hi aek,

How closely does the implementation follow the Spring implementation? I'm not very familiar with the multi action controller from Spring.

Thanks for your contribution!



--

Beau D. Simensen


Dragonfly Development Inc
http://dflydev.com/



--
You received this message because you are subscribed to the Google Groups "Halo General Discussion" group.
To post to this group, send email to halo...@googlegroups.com.
To unsubscribe from this group, send email to halo-php+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/halo-php?hl=en.


aek

unread,
Oct 18, 2010, 2:24:02 PM10/18/10
to Halo General Discussion
> How closely does the implementation follow the Spring implementation?

Very close, the idea is to have a single controller to handle a number
of configured urls. Something like to encapsulate a group of
functionalities in a controller, or more specifically in an object.
The flow is as follow:
1- The request arrive at the halo_MultiActionController
2- An method is found to serve the request using the configured method
name resolver strategy, there are 3 implementation explained below.
3- The method definition is get using the method name resolved, to see
if the method can handle the request, this means that the method need
to take at least 2 parameters(halo_HttpRequest $request,
halo_HttpResponse $response) and another optional parameter(an class
object argument to be created and filled with the parameters of the
request when present). The method resolved is called in the delegate,
delegate is by default the halo_MultiActionController so you can
inherit from halo_MultiActionController to add the handlers methods or
you can configure an stone with a className halo_MultiActionController
and in the property delegate a reference to another stone that
contains the handlers methods without the knowledge about
halo_MultiActionController

method name resolver strategies:
halo_InternalPathMethodNameResolver get the final file path of the url
and join with a prefix and a suffix if is set and use this as a
handler method name to execute in the delegate.

halo_ParameterMethodNameResolver get the value of a configured
parameter name from the request and use it as a handler method name to
execute in the delegate.

halo_PropertiesMethodNameResolver do something similar to
halo_SimpleUrlHandlerMapping but the result is a handler method name
to execute in the delegate.
Reply all
Reply to author
Forward
0 new messages