Skip to content

Commit 41531f0

Browse files
author
Marius
committed
fix relation decoration
1 parent b871c55 commit 41531f0

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/Decorators/AbstractResourceDecorator.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,18 @@ public static function applyHtmlSpecialChars(mixed $value): mixed
214214
*/
215215
public function isRelationAggregate(string $columnName): bool
216216
{
217+
$suffix = \substr($columnName, -6);
218+
$relationName = \substr($columnName, 0, -6);
219+
217220
return (
218-
\substr($columnName, -6) === static::COUNT_SUFFIX
219-
&& \in_array(\substr($columnName, 0, -6), $this->getCountRelations(), true)
220-
) || (
221-
\substr($columnName, -6) === static::EXIST_SUFFIX
222-
&& \in_array(\substr($columnName, 0, -6), $this->getExistRelations(), true)
223-
);
221+
\in_array($suffix, [static::COUNT_SUFFIX, static::EXIST_SUFFIX], true)
222+
&& isset($this->getRelationMappings()[$relationName])
223+
) || (
224+
$suffix === static::COUNT_SUFFIX
225+
&& \in_array($relationName, $this->getCountRelations(), true)
226+
) || (
227+
$suffix === static::EXIST_SUFFIX
228+
&& \in_array($relationName, $this->getExistRelations(), true)
229+
);
224230
}
225231
}

0 commit comments

Comments
 (0)