apply($queryBuilder, $resourceClass, $operation); } /** * Called by doctrine when getting an item. * * @param list $identifiers * @param mixed[] $context * * @throws \Exception */ public function applyToItem(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, array $identifiers, ?Operation $operation = null, array $context = []): void { $this->apply($queryBuilder, $resourceClass, $operation); } /** * Generic application of the extension. */ protected function apply(QueryBuilder $queryBuilder, string $resourceClass, ?Operation $operation): void { if (!$this->supports($resourceClass, $operation)) { return; } $this->addWhere($queryBuilder, $resourceClass, $operation); } /** * Returns true if the extension supports the given resource. */ abstract protected function supports(string $resourceClass, ?Operation $operation): bool; /** * Add one or more filters to the query. */ abstract protected function addWhere(QueryBuilder $queryBuilder, string $resourceClass, ?Operation $operation): void; }