mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
getParentIdNameRelation bug fixing and cleaning : This function is usefull only for the has_one and has_many relation but useless for many_many
Morerover, it manages well now the child heritage and parent heritage git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@53114 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
c5c3cf19b6
commit
eb018ad36a
@ -636,10 +636,7 @@ JS;
|
|||||||
$relations = singleton($parentClass)->$relation();
|
$relations = singleton($parentClass)->$relation();
|
||||||
$classes = ClassInfo::ancestry($childClass);
|
$classes = ClassInfo::ancestry($childClass);
|
||||||
foreach($relations as $k => $v) {
|
foreach($relations as $k => $v) {
|
||||||
if( $v == $childClass )
|
if(array_key_exists($v, $classes)) return $k . 'ID';
|
||||||
return $k . 'ID';
|
|
||||||
else if( array_key_exists( $v, $classes ) )
|
|
||||||
return $classes[ $v ] . 'ID';
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user