Hi Doug,

Just one general comment is that it really isn't the job (IMO) of the
controller to provide the model with the ORM beans. The model should work
self standing. The controller is just responsible for handling form, URL and
(probably) session scopes and for providing well parameterized calls to the
model and then to take the returned data from the model and to pass that to
the view.


Best Wishes,
Peter  


On 10/30/06 2:40 PM, "Doug Sims" <[EMAIL PROTECTED]> wrote:

>   Overall Goal:I am trying to expose a webservice (* using a
> coldspring RemoteFactoryBean to create a remoting facade).
> 
> I may be mixed up between the M and the C in MVC, but my model
> currently requires orm gateways or even the whole orm as a param.
>   In my current setup (see below) the controller is passing an
> instance of my orm(reactor), or sometimes just a gateway into the
> model. When I create the RemoteFactoryBean of the model directly, it
> expects the orm to be passed as a param. I was thinking by exposing
> the controller through the webservice, it would provide whatever the
> model needed. Here is the function in my controller as well as the
> corresponding one in the model
> 
> ----------------------------Controller Function------------------------
> <CFFUNCTION name="getUserToDoList" access="public" returntype="void"
> output="false">
>   <CFARGUMENT name="event" type="any">
> <cfset var UserID = session.user.getUserID()>
> <cfset var ORM = getModelGlue().getORMService() />
> <cfset var getList = getUserObject().getUserToDoList(UserID,ORM) />
> <cfset arguments.event.setValue("UserToDoList", getList)>
> </CFFUNCTION>
> 
> 
> 
> -------------Model Function---------------------------------------
> <cffunction name="getUserToDoList" access="public" returntype="query"
> output="false" hint="I get the user to do list data.">
> <cfargument name="UserID" type="string" required="true" />
> <cfargument name="ORM" type="any" required="true" hint="I am the ORM
> service, passed in by my controller" />
> <cfset var myUserID = arguments.userID />
> <cfset var myORM = arguments.ORM />
> <cfset var myList =
> myORM.createGateway("usertodolist").getByFields(userid="#myUserID#")
> />
> <cfreturn myList />
> </cffunction>
> 
> Should my model access the orm in another way?
> 
> Thanks in Advance,
> Doug
> 
> 
> On 10/30/06, Joe Rinehart <[EMAIL PROTECTED]> wrote:
>> Hey Doug,
>> 
>> That's a bit beyond the scope of what Model-Glue is meant for:  if
>> there's application logic inside your controllers, it should be moved
>> into a model class.  Then, you can use the class from either your
>> Model-Glue app or a remote application.
>> 
>> Can you maybe provide more info on what this controller does?  We can
>> try to sort it out together.
>> 
>> -Joe
>> 
>> --
>> Get Glued!
>> The Model-Glue ColdFusion Framework
>> http://www.model-glue.com
>> 
>> 
> 




Reply via email to