On 2012-03-29, at 2:16 PM, Ramsey Gurley wrote:

> 
> On Mar 29, 2012, at 1:48 PM, Theodore Petrosky wrote:
> 
>> I am creating an new object page with this.
>> 
>> public EditPageInterface createBriefAction() {
>> 
>>    EditPageInterface component = 
>> D2W.factory().editPageForNewObjectWithConfigurationNamed("CreateBrief", 
>> session());
>>    component.setNextPage(session().context().page());
>> 
>>    if(component instanceof D2WPage) {
>>        D2WPage page = (D2WPage)component;
>>        page.d2wContext().takeValueForKey("Brief.CreateBrief", 
>> "navigationState");
>>    }
>>    return component;
>> }
>> 
>> I want to pass in a date to the object. is this the 'correct' or mostest 
>> correct way:
>> 
>> ((D2WComponent) component).object().takeValueForKey( (new NSTimestamp()), 
>> "creationDate");
>> 
>> Ted
> 
> 
> Sounds like model logic. Do it in the model. If you just want to set a create 
> date, then use your EO's init() method.
> 
> public class Brief extends _Brief {
> 
>       public void init(EOEditingContext ec) {
>               super.init(ec);
>               setCreationDate(new NSTimestamp());
>       }
> 
> }
> 
> And if code is just too cumbersome, you can do it in the userInfo dictionary 
> of Brief inside your model :-)
> 
> <Screen shot 2012-03-29 at 2.10.43 PM.png>
> 
> You can read more about it here
> 
> http://webobjects.mdimension.com/hudson/job/Wonder/javadoc/er/extensions/eof/ERXEntityClassDescription.html

How have I never seen this before?? Good grief, Wonder is huge and magical.

D

> 
> Just do it in init() unless you want to use vanilla EOGenericRecords for some 
> reason.
> 
> Ramsey
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/programmingosx%40mac.com
> 
> This email sent to [email protected]

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to