Re: setData() verses createData() [ Farcry 6.2 ]
AJ Mercer <[email protected]> Tue, 11 Feb 2014 11:26:58 +0800
| Newsgroups | gmane.comp.cms.farcry.devel |
|---|---|
| Message-ID | <CAPURtC0tfBvJCt5wF=cYxE9Bt5KJT7NCK43WJJ5_8yboZL+jrg@mail.gmail.com> |
is version 7 a good time to consider COAPI changes? I assumed beforeSave() and afterSaved() would be called by createData()/setData() should setData() call createData() - or visa versa? On 11 February 2014 10:54, Justin Carter <[email protected]> wrote: > setData() checks first to see if a record exists, so it's less performant > (i.e. at least 2 queries for every "insert"), whereas createData() will > just try to do an insert. There may by some try/catches in the mix as well. > > I haven't looked at the code in detail but they should probably also be > consistent in regards to default values, I don't think the resultant data > should differ depending on which method you use. > > I'm not sure if there's an existing ticket related to this, but perhaps > you should create one if there isn't. Also if anyone wants to have a go at > fixing it I'm happy to receive pull requests - I'm just swamped at the > moment! > > cheers, > Justin > > cheers, > Justin > > -- > Justin Carter > http://www.madfellas.com/blog > http://twitter.com/justincarter > > > On Tue, Feb 11, 2014 at 1:49 PM, AJ Mercer <[email protected]> wrote: > >> nope - no difference >> >> What is the reason for having createData()? >> What is the difference from setData()? >> >> >> >> On 11 February 2014 10:44, Justin Carter <[email protected]>wrote: >> >>> Hmmm... Perhaps the formtool defaults should be getting applied in >>> createData() but aren't? >>> >>> Does anything different happen when you add default="false"? e.g. >>> >>> <cfproperty name="bContacted" type="boolean" ftType="boolean" >>> default="false" ftDefault="false" required="false" >>> ftSeq="210" ftWizardStep="PSL Contact Follow-up" ftFieldset="Update >>> Details" ftLabel="Contacted"> >>> >>> cheers, >>> Justin >>> >>> -- >>> Justin Carter >>> http://www.madfellas.com/blog >>> http://twitter.com/justincarter >>> >>> >>> On Tue, Feb 11, 2014 at 1:40 PM, AJ Mercer <[email protected]> wrote: >>> >>>> Hmmm, ok. Was assuming my beforeSave() was being called, but I put a >>>> cfabort in there and it is not called. >>>> >>>> I have boolean fields in my custom type, >>>> when createData() is used, they are set to empty string. >>>> when setData() is used, they are set to the (formtool) default >>>> >>>> >>>> <cfproperty name="bContacted" type="boolean" ftType="boolean" >>>> ftDefault="false" required="false" >>>> ftSeq="210" ftWizardStep="PSL Contact Follow-up" ftFieldset="Update >>>> Details" ftLabel="Contacted"> >>>> >>>> >>>> >>>> On 11 February 2014 10:21, Justin Carter <[email protected]>wrote: >>>> >>>>> Nope, I think the only time Core runs beforeSave() is when a form (or >>>>> wizard) is processed, and in createFromUpload() (for file/image >>>>> formtools) - it doesn't get run within createData() or setData(). I'm not >>>>> entirely happy with the way that part of the API currently works, but it's >>>>> easy enough to call beforeSave() manually before create/setData(). >>>>> >>>>> cheers, >>>>> Justin >>>>> >>>>> -- >>>>> Justin Carter >>>>> http://www.madfellas.com/blog >>>>> http://twitter.com/justincarter >>>>> >>>>> >>>>> On Tue, Feb 11, 2014 at 1:10 PM, AJ Mercer <[email protected]> wrote: >>>>> >>>>>> it seems that if createData() is used it does not fire beforeSave() >>>>>> where as setData() does, >>>>>> but with setData() you need to create an objectID >>>>>> >>>>>> Is this correct? >>>>>> >>>>>> -- >>>>>> >>>>>> *AJ Mercer* >>>>>> <webonix:net strength="Industrial" /> <http://webonix.net> | <webonix:org >>>>>> community="Open" /> <http://webonix.org> >>>>>> http://twitter.com/webonix >>>>>> Railo Community Manager<http://www.getrailo.org/index.cfm/community/team/> >>>>>> >>>>>> -- >>>>>> You received this message cos you are subscribed to "farcry-dev" >>>>>> Google group. >>>>>> To post, email: farcry-dev-/[email protected] >>>>>> To unsubscribe, email: farcry-dev+unsubscribe-/[email protected] >>>>>> For more options: http://groups.google.com/group/farcry-dev >>>>>> -------------------------------- >>>>>> Follow us on Twitter: http://twitter.com/farcry >>>>>> --- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "farcry-dev" group. >>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>> send an email to farcry-dev+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] >>>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>>> >>>>> >>>>> -- >>>>> You received this message cos you are subscribed to "farcry-dev" >>>>> Google group. >>>>> To post, email: farcry-dev-/[email protected] >>>>> To unsubscribe, email: farcry-dev+unsubscribe-/[email protected] >>>>> For more options: http://groups.google.com/group/farcry-dev >>>>> -------------------------------- >>>>> Follow us on Twitter: http://twitter.com/farcry >>>>> --- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "farcry-dev" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to farcry-dev+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] >>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>> >>>> >>>> >>>> >>>> -- >>>> >>>> *AJ Mercer* >>>> <webonix:net strength="Industrial" /> <http://webonix.net> | <webonix:org >>>> community="Open" /> <http://webonix.org> >>>> http://twitter.com/webonix >>>> Railo Community Manager<http://www.getrailo.org/index.cfm/community/team/> >>>> >>>> -- >>>> You received this message cos you are subscribed to "farcry-dev" Google >>>> group. >>>> To post, email: farcry-dev-/[email protected] >>>> To unsubscribe, email: farcry-dev+unsubscribe-/[email protected] >>>> For more options: http://groups.google.com/group/farcry-dev >>>> -------------------------------- >>>> Follow us on Twitter: http://twitter.com/farcry >>>> --- >>>> You received this message because you are subscribed to the Google >>>> Groups "farcry-dev" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to farcry-dev+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] >>>> For more options, visit https://groups.google.com/groups/opt_out. >>>> >>> >>> -- >>> You received this message cos you are subscribed to "farcry-dev" Google >>> group. >>> To post, email: farcry-dev-/[email protected] >>> To unsubscribe, email: farcry-dev+unsubscribe-/[email protected] >>> For more options: http://groups.google.com/group/farcry-dev >>> -------------------------------- >>> Follow us on Twitter: http://twitter.com/farcry >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "farcry-dev" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to farcry-dev+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >> >> >> >> -- >> >> *AJ Mercer* >> <webonix:net strength="Industrial" /> <http://webonix.net> | <webonix:org >> community="Open" /> <http://webonix.org> >> http://twitter.com/webonix >> Railo Community Manager<http://www.getrailo.org/index.cfm/community/team/> >> >> -- >> You received this message cos you are subscribed to "farcry-dev" Google >> group. >> To post, email: farcry-dev-/[email protected] >> To unsubscribe, email: farcry-dev+unsubscribe-/[email protected] >> For more options: http://groups.google.com/group/farcry-dev >> -------------------------------- >> Follow us on Twitter: http://twitter.com/farcry >> --- >> You received this message because you are subscribed to the Google Groups >> "farcry-dev" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to farcry-dev+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] >> For more options, visit https://groups.google.com/groups/opt_out. >> > > -- > You received this message cos you are subscribed to "farcry-dev" Google > group. > To post, email: farcry-dev-/[email protected] > To unsubscribe, email: farcry-dev+unsubscribe-/[email protected] > For more options: http://groups.google.com/group/farcry-dev > -------------------------------- > Follow us on Twitter: http://twitter.com/farcry > --- > You received this message because you are subscribed to the Google Groups > "farcry-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to farcry-dev+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] > For more options, visit https://groups.google.com/groups/opt_out. > -- *AJ Mercer* <webonix:net strength="Industrial" /> <http://webonix.net> | <webonix:org community="Open" /> <http://webonix.org> http://twitter.com/webonix Railo Community Manager <http://www.getrailo.org/index.cfm/community/team/> -- You received this message cos you are subscribed to "farcry-dev" Google group. To post, email: farcry-dev-/[email protected] To unsubscribe, email: farcry-dev+unsubscribe-/[email protected] For more options: http://groups.google.com/group/farcry-dev -------------------------------- Follow us on Twitter: http://twitter.com/farcry --- You received this message because you are subscribed to the Google Groups "farcry-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to farcry-dev+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit https://groups.google.com/groups/opt_out.