mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
chore: in fact, it is ICANN that accredits the registrars
This commit is contained in:
28
src/Api/Extension/NotNullAccreditationIcannExtension.php
Normal file
28
src/Api/Extension/NotNullAccreditationIcannExtension.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Api\Extension;
|
||||
|
||||
use ApiPlatform\Doctrine\Orm\Extension\QueryCollectionExtensionInterface;
|
||||
use ApiPlatform\Doctrine\Orm\Util\QueryNameGeneratorInterface;
|
||||
use ApiPlatform\Metadata\Operation;
|
||||
use App\Entity\Entity;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
|
||||
class NotNullAccreditationIcannExtension implements QueryCollectionExtensionInterface
|
||||
{
|
||||
public function applyToCollection(
|
||||
QueryBuilder $queryBuilder,
|
||||
QueryNameGeneratorInterface $queryNameGenerator,
|
||||
string $resourceClass,
|
||||
?Operation $operation = null,
|
||||
array $context = [],
|
||||
): void {
|
||||
if (Entity::class !== $resourceClass) {
|
||||
return;
|
||||
}
|
||||
if ($operation && 'icann_accreditations_collection' === $operation->getName()) {
|
||||
$rootAlias = $queryBuilder->getRootAliases()[0];
|
||||
$queryBuilder->andWhere(sprintf('%s.icannAccreditation.status IS NOT NULL', $rootAlias));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user