. */ namespace App\Repository\Parts; use App\Entity\Parts\Category; use App\Entity\Parts\Storelocation; use App\Repository\AbstractPartsContainingRepository; class CategoryRepository extends AbstractPartsContainingRepository { public function getParts(object $element, array $order_by = ['name' => 'ASC']): array { if (!$element instanceof Category) { throw new \InvalidArgumentException('$element must be an Category!'); } return $this->getPartsByField($element, $order_by, 'category'); } public function getPartsCount(object $element): int { if (!$element instanceof Category) { throw new \InvalidArgumentException('$element must be an Category!'); } return $this->getPartsCountByField($element, 'category'); } }