Skip to content

Commit

Permalink
Fix: fixtures loading with single inheritance
Browse files Browse the repository at this point in the history
I wasn't able to load fixtures with inheritance because when I
defined a Novel in my fixtures (which extends Book), it would be saved
by the sfPropelData class in a 'object_references' property under the
'%class%_%pk%' key (Novel_42 for instance).

Unfortunately, if I reference later in my fixtures this novel, the class
would look up in the cache but with the wrong key (it would use Book_42).
  • Loading branch information
Kévin Gomez Pinto committed Apr 10, 2012
1 parent 8ec5823 commit 63fb1f6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/addon/sfPropelData.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,9 @@ public function loadDataFromArray($data)
// save the object for future reference
if (method_exists($obj, 'getPrimaryKey'))
{
$this->object_references[$class.'_'.$key] = $obj;
$peer = $class::PEER;
$class_key = $peer::OM_CLASS;
$this->object_references[$class_key.'_'.$key] = $obj;
}
}
}
Expand Down

0 comments on commit 63fb1f6

Please sign in to comment.