I have code similar to this running inside an xPDOObject:
$newObject = $this->xpdo->newObject('MyClass'));
$this->addOne($newObject,'CorrectAlias');
$saved = $this->save();
The result: Record ’
$this’ is saved correctly, but record ’
$newObject’ is not added to the DB.
My workaround:
$saved = $this->save();
$newObject = $this->xpdo->newObject('MyClass',array('relatedKey'=>$this->get('id')));
$newObject->save();
A little strange to have to remember not to use $this->addOne().
I have, however, successfully used addOne from outside an object:
$object1->addOne($object2);
MODx 1.0.4, MySQL 5, Apache 2.2, PHP 5.2.12, xPDO-2.0.0-rc1 (Hey I just noticed RC3!)
To Do: Will try XPDO RC3 and also version that ships with Revo 2.