BUGFIX: fix to #110845 to allow parsing of the DataObject file in PHP 5.2 and below.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@110863 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Julian Seidenberg 2010-09-16 05:53:16 +00:00
parent ed666b71b7
commit c32a6e34a0

View File

@ -408,13 +408,10 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
// DO NOT copy has_many relations, because copying the relation would result in us changing the has_one relation
// on the other side of this relation to point at the copy and no longer the original (being a has_one, it can
// only point at one thing at a time). So, all relations except has_many can and are copied
if ($sourceObject::$has_one) foreach($sourceObject::$has_one as $name => $type) {
if ($sourceObject->has_one()) foreach($sourceObject->has_one() as $name => $type) {
$this->duplicateRelations($sourceObject, $destinationObject, $name);
}
if ($sourceObject::$many_many) foreach($sourceObject::$many_many as $name => $type) {
$this->duplicateRelations($sourceObject, $destinationObject, $name);
}
if ($sourceObject::$belongs_many_many) foreach($sourceObject::$belongs_many_many as $name => $type) {
if ($sourceObject->many_many()) foreach($sourceObject->many_many() as $name => $type) { //many_many include belongs_many_many
$this->duplicateRelations($sourceObject, $destinationObject, $name);
}