Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Data Model Questions /

Override the "Created" property


Reply


2 Posts   916 Views

Avatar
rob.s

Community Member, 78 Posts

13 August 2011 at 7:15pm

Hi,

because of migrating data to a new SS Website i have to import data.
The import itself is handled by a custom "Task".

I need to set the "Created" (datetime) property while importing.
But SS ignores the set values.

E.g.:

...
$o = new CustomDataObject();
$o->Created = '2000-01-01 00:00:00';
$o->write();

After saving the Created datetime is always the datetime of execution - NOT my given value.
I do not want to add a new property like "CreatedAt" to the DataObject.

Is it possible to override this behaviour ?

Greetings,
Rob

Avatar
martimiz

Forum Moderator, 1132 Posts

14 August 2011 at 4:40am

the write() function will set Created to 'now' on every new insert. You could maybe use the return ID to update the record after it's written...