mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Merged from branches/2.3
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@77141 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
7a18cd8bec
commit
0f237b0c57
@ -478,29 +478,31 @@ JS;
|
|||||||
|
|
||||||
function getFieldsFor($childData) {
|
function getFieldsFor($childData) {
|
||||||
// See if our parent class has any many_many relations by this source class
|
// See if our parent class has any many_many relations by this source class
|
||||||
if($this->sourceID()) {
|
if($this->getParentClass()) {
|
||||||
$parentClass = DataObject::get_by_id($this->getParentClass(), $this->sourceID());
|
if($this->sourceID()) {
|
||||||
} else {
|
$parentClass = DataObject::get_by_id($this->getParentClass(), $this->sourceID());
|
||||||
$parentClass = singleton($this->getParentClass());
|
} else {
|
||||||
}
|
$parentClass = singleton($this->getParentClass());
|
||||||
|
|
||||||
$manyManyRelations = $parentClass->many_many();
|
|
||||||
$manyManyRelationName = null;
|
|
||||||
$manyManyComponentSet = null;
|
|
||||||
|
|
||||||
$hasManyRelations = $parentClass->has_many();
|
|
||||||
$hasManyRelationName = null;
|
|
||||||
$hasManyComponentSet = null;
|
|
||||||
|
|
||||||
if($manyManyRelations) foreach($manyManyRelations as $relation => $class) {
|
|
||||||
if($class == $this->sourceClass()) {
|
|
||||||
$manyManyRelationName = $relation;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if($hasManyRelations) foreach($hasManyRelations as $relation => $class) {
|
$manyManyRelations = $parentClass->many_many();
|
||||||
if($class == $this->sourceClass()) {
|
$manyManyRelationName = null;
|
||||||
$hasManyRelationName = $relation;
|
$manyManyComponentSet = null;
|
||||||
|
|
||||||
|
$hasManyRelations = $parentClass->has_many();
|
||||||
|
$hasManyRelationName = null;
|
||||||
|
$hasManyComponentSet = null;
|
||||||
|
|
||||||
|
if($manyManyRelations) foreach($manyManyRelations as $relation => $class) {
|
||||||
|
if($class == $this->sourceClass()) {
|
||||||
|
$manyManyRelationName = $relation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($hasManyRelations) foreach($hasManyRelations as $relation => $class) {
|
||||||
|
if($class == $this->sourceClass()) {
|
||||||
|
$hasManyRelationName = $relation;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -513,7 +515,7 @@ JS;
|
|||||||
|
|
||||||
$detailFields = $this->getCustomFieldsFor($childData);
|
$detailFields = $this->getCustomFieldsFor($childData);
|
||||||
|
|
||||||
if($hasManyRelationName && $childData->ID) {
|
if($this->getParentClass() && $hasManyRelationName && $childData->ID) {
|
||||||
$hasManyComponentSet = $parentClass->getComponents($hasManyRelationName);
|
$hasManyComponentSet = $parentClass->getComponents($hasManyRelationName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user