• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

api-platform / core / 20847864477

09 Jan 2026 09:47AM UTC coverage: 29.1% (+0.005%) from 29.095%
20847864477

Pull #7649

github

web-flow
Merge b342dd5db into d640d106b
Pull Request #7649: feat(validator): uuid/ulid parameter validation

0 of 4 new or added lines in 1 file covered. (0.0%)

15050 existing lines in 491 files now uncovered.

16996 of 58406 relevant lines covered (29.1%)

81.8 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/Doctrine/Orm/Filter/FreeTextQueryFilter.php
1
<?php
2

3
/*
4
 * This file is part of the API Platform project.
5
 *
6
 * (c) Kévin Dunglas <dunglas@gmail.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

12
declare(strict_types=1);
13

14
namespace ApiPlatform\Doctrine\Orm\Filter;
15

16
use ApiPlatform\Doctrine\Common\Filter\LoggerAwareInterface;
17
use ApiPlatform\Doctrine\Common\Filter\LoggerAwareTrait;
18
use ApiPlatform\Doctrine\Common\Filter\ManagerRegistryAwareInterface;
19
use ApiPlatform\Doctrine\Common\Filter\ManagerRegistryAwareTrait;
20
use ApiPlatform\Doctrine\Orm\Util\QueryNameGeneratorInterface;
21
use ApiPlatform\Metadata\BackwardCompatibleFilterDescriptionTrait;
22
use ApiPlatform\Metadata\Operation;
23
use Doctrine\Common\Collections\ArrayCollection;
24
use Doctrine\ORM\QueryBuilder;
25

26
final class FreeTextQueryFilter implements FilterInterface, ManagerRegistryAwareInterface, LoggerAwareInterface
27
{
28
    use BackwardCompatibleFilterDescriptionTrait;
29
    use LoggerAwareTrait;
30
    use ManagerRegistryAwareTrait;
31

32
    /**
33
     * @param list<string> $properties an array of properties, defaults to `parameter->getProperties()`
34
     */
35
    public function __construct(private readonly FilterInterface $filter, private readonly ?array $properties = null)
36
    {
UNCOV
37
    }
3✔
38

39
    public function apply(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, ?Operation $operation = null, array $context = []): void
40
    {
UNCOV
41
        if ($this->filter instanceof ManagerRegistryAwareInterface) {
8✔
UNCOV
42
            $this->filter->setManagerRegistry($this->getManagerRegistry());
6✔
43
        }
44

UNCOV
45
        if ($this->filter instanceof LoggerAwareInterface) {
8✔
UNCOV
46
            $this->filter->setLogger($this->getLogger());
6✔
47
        }
48

UNCOV
49
        $parameter = $context['parameter'];
8✔
UNCOV
50
        $qb = clone $queryBuilder;
8✔
UNCOV
51
        $qb->resetDQLPart('where');
8✔
UNCOV
52
        $qb->setParameters(new ArrayCollection());
8✔
UNCOV
53
        foreach ($this->properties ?? $parameter->getProperties() ?? [] as $property) {
8✔
UNCOV
54
            $this->filter->apply(
8✔
UNCOV
55
                $qb,
8✔
UNCOV
56
                $queryNameGenerator,
8✔
UNCOV
57
                $resourceClass,
8✔
UNCOV
58
                $operation,
8✔
UNCOV
59
                ['parameter' => $parameter->withProperty($property)] + $context
8✔
UNCOV
60
            );
8✔
61
        }
62

UNCOV
63
        $queryBuilder->andWhere($qb->getDQLPart('where'));
8✔
UNCOV
64
        $parameters = $queryBuilder->getParameters();
8✔
65

UNCOV
66
        foreach ($qb->getParameters() as $p) {
8✔
UNCOV
67
            $parameters->add($p);
8✔
68
        }
69

UNCOV
70
        $queryBuilder->setParameters($parameters);
8✔
71
    }
72
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc