Wednesday, November 10, 2010

XPDO save with addOne

updates: dec 16: My mistake, ive used addOne on a one to many relation, therefore, should use addMany instead of addOne..


im not sure if this is a bug or the way it should be working.

It seems that if we addOne() to a new object, and save the parent object, the child object and parent object get saved.

But if we edit an existing parent object, and use addOne, the child object did not get saved when i call parentobject->save()...
Please note that the parent object is not modified in my case.

updates: dec 13: relying on addOne to save record is not recommended. Best to set the foreign key value manually.

Hope this help ya :)

No comments: