Removed extra lookup of the list

This commit is contained in:
UndefinedOffset 2018-04-17 13:46:12 -03:00 committed by Daniel Hensby
parent af3a9f3ec8
commit 36198c482e
No known key found for this signature in database
GPG Key ID: B00D1E9767F0B06E

View File

@ -586,8 +586,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
$relations = $sourceObject->$name(); $relations = $sourceObject->$name();
if ($relations) { if ($relations) {
if ($relations instanceOf ManyManyList) { //many-to-many relation if ($relations instanceOf ManyManyList) { //many-to-many relation
$source = $sourceObject->getManyManyComponents($name); $extraFieldNames = $relations->getExtraFields();
$extraFieldNames = $source->getExtraFields();
if ($relations->Count() > 0) { //with more than one thing it is related to if ($relations->Count() > 0) { //with more than one thing it is related to
foreach($relations as $relation) { foreach($relations as $relation) {