Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.2.1
-
Fix Version/s: None
-
Component/s: Record, Relations, Validators
-
Labels:None
Description
Doctrine_Validator_ForeignKeys_TestCase#testForeignKeyIsValidIfLocalRelationIsSet()
This test passes fine as is. But it fails if I make the following change:
public function testForeignKeyIsValidIfLocalRelationIsSet()
{
//$person = new TestPerson();
$address = new TestAddress();
//$address->Person = $person;
$address->Person->first_name = "John";
$table = $address->getTable();
$errors = $table->validateField('person_id', $address->person_id, $address);
$this->assertEqual(0, $errors->count());
}
The only difference is that instead of explicitly assigning $address->Person, I'm letting it happen automatically when assigning the first name. What is it about the property chaining when creating the related record that screws up doctrine's internal reference tracking?
This is an existing test case for which I've added two tests. The first one fails, while the second passes. The first one captures the issue I'm experiencing.