The other option is to use the default property and unsaved value (for persistent cfcs) to always have default value set for your property. Keep in mind that CF 9's ORM implementation will return Java nulls if you don't specify a value.
--Kurt On Tue, Jul 13, 2010 at 9:01 PM, Sumit Verma <[email protected]> wrote: > How are you using the event-bean? Are you specifying the fields or let > Mach-ii populate everything "automagically"? If you don't specify the field > list in the event-bean then the bean gets populated by calling the init > method with all the items in event-arg. So, you need to make sure your init > method initializes the bean by calling setters. > Here is my init method that I use in the base entity that all the other > entities extend: > public function init() { > if(!structIsEmpty(arguments)){ > for(item in arguments){ > if(structKeyExists(this,"set#item#")){ > evaluate("this.set#item#(arguments[item])"); > } > } > } > } > > HTH. > Sumit Verma > Partner / Vice President | ten24, LLC > office: 877.886.5806 x 103 | mobile: 617.290.8214 > www.ten24web.com | www.linkedin.com/in/sverma | twitter: blogonria > > > On Tue, Jul 13, 2010 at 4:34 PM, jlcox <[email protected]> wrote: >> >> I've been trying to use event-bean in concert with the new CF9 >> implicit accessor methods without success on Mach-II 1.8.0.8. >> >> For instance, consider a bean: >> >> component accessors="true" >> { >> property numeric Id; >> property string Name; >> property string Title; >> >> simpleBean function init() { >> return this; >> } >> >> } >> >> If I have an event-arg named "Id", I'd normally expect the Id property >> of the bean to be automatically set to that value, but using the >> simplified bean above, the property does not get set. Has anyone had >> any luck doing this? >> >> -- >> You received this message because you are subscribed to Mach-II for CFML >> list. >> To post to this group, send email to >> [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/mach-ii-for-coldfusion?hl=en >> >> ***New URLs as of April 29th, 2010*** >> SVN: http://svn.mach-ii.com/machii/ >> Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/ > > -- > You received this message because you are subscribed to Mach-II for CFML > list. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/mach-ii-for-coldfusion?hl=en > > ***New URLs as of April 29th, 2010*** > SVN: http://svn.mach-ii.com/machii/ > Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/ > -- You received this message because you are subscribed to Mach-II for CFML list. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/mach-ii-for-coldfusion?hl=en ***New URLs as of April 29th, 2010*** SVN: http://svn.mach-ii.com/machii/ Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/
