hi all, I'm new to Phalcon and trying to understand the model relations.
I have a very simple hasOne() relationship.
$test1 = Models::getModel('Test1');
$test1->name = 'test1 name';
//$test1->test2_id // I have this on the model which I would expect to be populated by child->id
$test2 = Models::getModel('Test2');
$test2->name = 'Test2';
$test1->test2 = $test2; // I believe this is a magic param.
$test1->save()
So, it does save both records, but Test1->test2_id is 0, where I would expect it to be test2->id
More setup info:
Test1 model
public function initialize()
{
$this->hasOne("test2_id", "Test2", "id");
}
Test2 model
public function initialize()
{
$this->hasOne("id", "Test1", "test2_id");
}
Any ideas ? a little confused...