mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX Stricter checking that a relation exists on ComplexTableField::saveComplexTableField() (from r106755)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112536 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
0acb21d219
commit
a1f9efc414
@ -650,16 +650,16 @@ JS;
|
|||||||
if(isset($data['ctf']['manyManyRelation'])) {
|
if(isset($data['ctf']['manyManyRelation'])) {
|
||||||
$parentRecord = DataObject::get_by_id($data['ctf']['parentClass'], (int) $data['ctf']['sourceID']);
|
$parentRecord = DataObject::get_by_id($data['ctf']['parentClass'], (int) $data['ctf']['sourceID']);
|
||||||
$relationName = $data['ctf']['manyManyRelation'];
|
$relationName = $data['ctf']['manyManyRelation'];
|
||||||
$componentSet = $parentRecord->getManyManyComponents($relationName);
|
$componentSet = $parentRecord ? $parentRecord->getManyManyComponents($relationName) : null;
|
||||||
$componentSet->add($childData);
|
if($componentSet) $componentSet->add($childData);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($data['ctf']['hasManyRelation'])) {
|
if(isset($data['ctf']['hasManyRelation'])) {
|
||||||
$parentRecord = DataObject::get_by_id($data['ctf']['parentClass'], (int) $data['ctf']['sourceID']);
|
$parentRecord = DataObject::get_by_id($data['ctf']['parentClass'], (int) $data['ctf']['sourceID']);
|
||||||
$relationName = $data['ctf']['hasManyRelation'];
|
$relationName = $data['ctf']['hasManyRelation'];
|
||||||
|
|
||||||
$componentSet = $parentRecord->getComponents($relationName);
|
$componentSet = $parentRecord ? $parentRecord->getComponents($relationName) : null;
|
||||||
$componentSet->add($childData);
|
if($componentSet) $componentSet->add($childData);
|
||||||
}
|
}
|
||||||
|
|
||||||
$referrer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null;
|
$referrer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user