It would create an instance of a new Product object, populate it with
initial values (using the passed attributes struct), and return the
populated Product object:
<cffunction name="getProduct" access="public" returntype="Product"
output="false" roles="" hint="Return a new Product instance.">
<cfargument name="initialValues" type="struct" required="true"
hint="Initial values for the new Product." />
<cfreturn createObject( 'component', 'Product' ).init(
argumentCollection=arguments.initialValues ) />
</cffunction>
On 8/30/05, wolf2k5 <[EMAIL PROTECTED]> wrote:
> On 8/30/05, Brian Kotek <[EMAIL PROTECTED]> wrote:
> > "should only call the manager" is a bit binding, but the idea is that,
> > generally, the framework only interacts with the domain model by going
> > through the manager. However, in this case I wouldn't see any issue
> > with adding validate() to the Product CFC, then calling that method
> > from your circuit XML. So you might end up with something like:
> >
> > <fuseaction name="processnewproduct" access="public">
> > <invoke object="application.productManager"
> > methodcall="getProduct( attributes )"
> > returnvariable="user"/>
> > <if condition="#product.validate()#">
> > <true>
> > <!-- Validation successful? -->
> > <invoke object="application.productManager"
> > methodcall="save( product
> > )"/>
> > <relocate
> > url="#myFusebox.originalCircuit#.success"/>
> > </true>
> > <false>
> > <!-- If not successful, display the
> > form again. -->
> > <do action="productForm" />
> > </false>
> > </if>
> > </fuseaction>
>
> That makes sense, but what would the getProduct method of the
> productManager component do exactly?
>
> Thanks again.
>
>
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email to
> [email protected] with the words 'unsubscribe cfcdev' as the subject of the
> email.
>
> CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
> (www.cfxhosting.com).
>
> CFCDev is supported by New Atlanta, makers of BlueDragon
> http://www.newatlanta.com/products/bluedragon/index.cfm
>
> An archive of the CFCDev list is available at
> www.mail-archive.com/[email protected]
>
>
>
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
[email protected] with the words 'unsubscribe cfcdev' as the subject of the
email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
(www.cfxhosting.com).
CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]