diff --git a/api/src/Repository/ObjectEntityRepository.php b/api/src/Repository/ObjectEntityRepository.php index 8da2f4a17..9f3b68051 100644 --- a/api/src/Repository/ObjectEntityRepository.php +++ b/api/src/Repository/ObjectEntityRepository.php @@ -66,7 +66,10 @@ public function getFilterParameters(Entity $Entity, string $prefix = '', int $le $filters[] = $prefix.$attribute->getName(); } elseif ($attribute->getObject() && $level < 3 && !str_contains($prefix, $attribute->getName().'.')) { $attribute->getSearchable() && $filters[] = $prefix.$attribute->getName(); - $embeddedString = $embedded && $level > 1 ? 'embedded.' : ''; + $embeddedString = ''; + if ($embedded && $level > 1) { + $embeddedString = 'embedded.'; + } $filters = array_merge($filters, $this->getFilterParameters($attribute->getObject(), $prefix.$embeddedString.$attribute->getName().'.', $level + 1, $embedded)); } } @@ -86,7 +89,10 @@ public function getFilterParameters(Entity $Entity, string $prefix = '', int $le */ public function getOrderParameters(Entity $Entity, string $prefix = '', int $level = 1, bool $embedded = false): array { - $prefix = $embedded && $level === 2 ? "embedded.$prefix" : $prefix; + $prefix = $prefix; + if ($embedded && $level === 2) { + $prefix = "embedded.$prefix"; + } // defaults $sortable = [$prefix.'_dateCreated', $prefix.'_dateModified']; @@ -94,7 +100,10 @@ public function getOrderParameters(Entity $Entity, string $prefix = '', int $lev if (in_array($attribute->getType(), ['string', 'date', 'datetime', 'integer', 'float', 'number']) && $attribute->getSortable()) { $sortable[] = $prefix.$attribute->getName(); } elseif ($attribute->getObject() && $level < 3 && !str_contains($prefix, $attribute->getName().'.')) { - $embeddedString = $embedded && $level > 1 ? 'embedded.' : ''; + $embeddedString = ''; + if ($embedded && $level > 1) { + $embeddedString = 'embedded.'; + } $sortable = array_merge($sortable, $this->getOrderParameters($attribute->getObject(), $prefix.$embeddedString.$attribute->getName().'.', $level + 1)); } }