Ticket #1113 (closed defect: fixed)
If relationship is not saved on first save, it does not work
| Reported by: | lsolesen | Owned by: | romanb |
|---|---|---|---|
| Priority: | minor | Milestone: | |
| Component: | Relations | Version: | 0.11.0 |
| Severity: | Keywords: | ||
| Cc: | Has Test: | ||
| Status: | Has Patch: |
Description
The following code will not work:
$registrar3 = new VIH_Model_Course_Registration(); $registrar3->Course = $course1; $registrar3->vaerelse = 'test'; $registrar3->save();
$reopend = Doctrine::getTable('VIH_Model_Course_Registration')->findOneById($registrar3->id); $reopend->Subjects[] = $subject1; $reopend->save();
echo '<h2>Registar3 reopened subjects</h2>'; foreach ($reopend->Subjects as $subject) {
echo $subject->navn;
}
Model for the registration can be found here:
http://svn.intraface.dk/vih/trunk/hojskole/src/VIH/Model/Course/Registration.php
If I save the Subjects right away, it will work. But if I save first and the reopen the registration and try to access Subjects, I get:
Doctrine_Record_Exception: Unknown record property / related component "Subjects" on "VIH_Model_Course_Registration".
An entire test script can be found here: http://svn.intraface.dk/vih/trunk/hojskole/examples/doctrinebug.php