In your decorator create a method called configure(), and in there, set the
properties.  To set a date to null, call setPropertyNameNull().  For
example, if you had a date property called "BirthDate", then you'd call
setBirthDateNull().

HTH,
Bob

On Mon, Mar 23, 2009 at 7:32 PM, Matthew <[email protected]> wrote:

>
> I now sort of know why Transfer defaults the date to Now() because you
> can't default it to null or "" because when you call the init which
> calls the setter on any date field it'll want to pass in a date -
> which null and "" are not. I ran into the same problem before I used
> transfer - very annoying. There must be a solution. Other languages
> would have the same issue. I'm struggling to work a way around this.
> If you write a decorator to default it to "" it throws the same error
> i.e "" is not a date. Has anyone solved this issue i.e. have they gone
> for the decorator, custom method or configure method solution. A
> snippit of code and a snippit of config would be appreciated.
>
> Cheers
> Matthew
>
> On Mar 23, 5:04 pm, Matthew <[email protected]> wrote:
> > Thanks Mark.
> >
> > I can't figure it out at first glance what I'm meant to do so I'll
> > have to read up about each technique (Customer Methods, Configure
> > Method and Decorators) to see which one I can use to set it the date
> > to null. It'll be useful to know what each of these 3 techniques do
> > for future reference anyway.
> >
> > Perhaps it would be useful to add a link from the Transfer
> > Configuration File (http://docs.transfer-orm.com/wiki/
> > Transfer_Configuration_File.cfm) to the page you've just pointed me
> > to. Probably best to add it to this line "nullable (optional)  Defines
> > whether or not values from this property can be inserted into the
> > database as NULL values.". I'll leave it up to you.
> >
> > Cheers
> > Matthew
> >
> > On Mar 23, 4:39 pm, Mark Mandel <[email protected]> wrote:
> >
> > >http://docs.transfer-orm.com/wiki/Default_Property_Values.cfm
> >
> > > Mark
> >
> > > On Mon, Mar 23, 2009 at 4:35 PM, Matthew <[email protected]>
> wrote:
> >
> > > > Hi Bob
> >
> > > > Thanks for saving my time. I read that post and it looks like many
> > > > people have run into the same problem. I think that it's very odd to
> > > > default the date to Now(). It should be defaulted to NULL and then
> the
> > > > nullvalue property should have the option to set it to now perhaps
> > > > nullvalue="$now".
> >
> > > > Anyway. I'll try and work out this configure() hack now.
> >
> > > > Cheers
> > > > Matthew
> >
> > > > On Mar 23, 4:14 pm, Bob Silverberg <[email protected]> wrote:
> > > > > See here:
> >
> > > > >
> http://groups.google.com/group/transfer-dev/browse_thread/thread/fb2a...
> >
> > > > > In a nutshell, that is the expected behaviour.  Use configure() if
> you
> > > > want
> > > > > your dates set to null by default.
> >
> > > > > Bob
> >
> > > > > On Mon, Mar 23, 2009 at 1:08 AM, Matthew <
> [email protected]>
> > > > wrote:
> >
> > > > > > Hi
> >
> > > > > > I'm trying to work out why when I get Transfer to create an empty
> > > > > > object/bean it is setting the only date field of this object to
> > > > > > today's date and not null?!?!?
> >
> > > > > > I'm scanning through the docs, reading forum and investigating
> > > > > > Transfer code but thought I might get a quick answer here.
> >
> > > > > > **CF CODE**
> > > > > > getTransfer().get('PressRelease',0)
> >
> > > > > > **CONFIG**
> > > > > > <object name="PressRelease" table="press_release">
> > > > > >        <id name="pressReleaseId" column="press_release_id"
> > > > > > type="numeric"></
> > > > > > id>
> > > > > >        <property name="heading" type="string"></property>
> > > > > >        <property name="releaseDate" column="release_date"
> type="date"
> > > > > > nullable="true"></property>
> > > > > > </object>
> >
> > > > > > **ENVIRONMENT**
> > > > > > Transfer 1.6
> > > > > > CF 7
> > > > > > SQL Server
> >
> > > > > > Hope someone can help. I'll keep searching.
> > > > > > Cheers
> > > > > > Matthew
> >
> > > > > --
> > > > > Bob Silverbergwww.silverwareconsulting.com
> >
> > > --
> > > E: [email protected]
> > > W:www.compoundtheory.com
> >
>


-- 
Bob Silverberg
www.silverwareconsulting.com

--~--~---------~--~----~------------~-------~--~----~
Before posting questions to the group please read:
http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer

You received this message because you are subscribed to the Google Groups 
"transfer-dev" group.
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/transfer-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to