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

api-platform / core / 18343625207

08 Oct 2025 11:48AM UTC coverage: 24.542% (-0.02%) from 24.561%
18343625207

push

github

web-flow
fix(state): object mapper on delete operation (#7447)

fixes #7434

1 of 49 new or added lines in 2 files covered. (2.04%)

7084 existing lines in 207 files now uncovered.

14004 of 57061 relevant lines covered (24.54%)

26.01 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
    }
2✔
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