blog.view
blog.addcomment
blog.edit
Each of these does something with a blog entry. For each then I need
to look at rc.blogid and load a blog entity. In Model-Glue, I'd have
all 3 events broadcast a getBlogEntry message. I'd have a controller
method that would get and validate event.getValue("blogid"). Each
event would run that first, then do what they need to.
In FW/1, I'm not sure how to get the same behavior. My best guess is
that I could make a private method in my controller to handle getting/
validating rc.blogid and setting rc.blog to the result of a service
call.
Does that seem sensible?
public void function edit(){
if(isNumeric(rc.id)){
rc.user = variables.fw.getService("User").load(rc.id);
if( isNull(rc.user)){
rc.error = "User not found";
} else {
rc.roles = variables.fw.getService("Role").list();
}
} else {
rc.error = "Invalid id";
}
}
It calls a load method.
public any function load(Numeric id){
if(arguments.id == 0){
return new();
} else {
return entityLoadByPK("User",arguments.id);
}
}
I guess I still don't understand your question, hope this helps at
all :)
The before method runs before any function in the section controller
so you could check if the "blogid" is defined and if it is, validate
it (invoking a function directly).
Hope that makes sense.
On Feb 27, 2:04 pm, Raymond Camden <rcam...@gmail.com> wrote:
--
You received this message because you are subscribed to the Google Groups "framework-one" group.
To post to this group, send email to framew...@googlegroups.com.
To unsubscribe from this group, send email to framework-on...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/framework-one?hl=en.
On Feb 27, 2:37 pm, Andrew <colossina...@gmail.com> wrote:
> Could you use doController?
>
> http://fw1.riaforge.org/wiki/index.cfm/ReferenceManual#private_void_f...
--
You received this message because you are subscribed to the Google Groups "framework-one" group.
To post to this group, send email to framew...@googlegroups.com.
To unsubscribe from this group, send email to framework-on...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/framework-one?hl=en.
Dave
Remember that in Model-Glue you'd repeat the broadcast in three
events. In other words, you have the duplication already because
you're "calling" the getBlogEntry() method one way or another.
In FW/1, you have one line - var blogEntry =
variables.blogService.getBlogEntry( rc.id ); - in three controllers.
In Model-Glue, you have one line (of XML, broadcasting needBlogEntry)
in three event handlers. Exactly the same principle.
--
Sean A Corfield -- (904) 302-SEAN
Railo Technologies US -- http://getrailo.com/
An Architect's View -- http://corfield.org/
"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood
"Although this is currently the documented way to invoke a specific
controller method within Application.cfc methods, a cleaner, supported
way to do this is likely to be provided in future (although these
methods will remain for backward compatibility - deprecated)."
On Mar 1, 9:12 pm, John Allen <johnfal...@gmail.com> wrote:
> I'm finding that adding private methods to my controllers to handle
> duplicate code like this is very easy to work with.
>
> On Mon, Mar 1, 2010 at 6:10 PM, Sean Corfield <seancorfi...@gmail.com>wrote:
>
>
>
http://fw1.riaforge.org/wiki/index.cfm/DevelopingApplicationsManual#Taking_Actions_on_Every_Request
Example:
function setupRequest() {
var security = getController('securityController');
doController( security, 'checkAuthorization' );
}
Ryan