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

api-platform / core / 6067528200

04 Sep 2023 12:12AM UTC coverage: 36.875% (-21.9%) from 58.794%
6067528200

Pull #5791

github

web-flow
Merge 64157e578 into d09cfc9d2
Pull Request #5791: fix: strip down any sql function name

3096 of 3096 new or added lines in 205 files covered. (100.0%)

9926 of 26918 relevant lines covered (36.87%)

6.5 hits per line

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

93.33
/src/Symfony/Validator/State/QueryParameterValidateProvider.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\Symfony\Validator\State;
15

16
use ApiPlatform\Api\QueryParameterValidator\QueryParameterValidator;
17
use ApiPlatform\Doctrine\Orm\State\Options;
18
use ApiPlatform\Metadata\CollectionOperationInterface;
19
use ApiPlatform\Metadata\HttpOperation;
20
use ApiPlatform\Metadata\Operation;
21
use ApiPlatform\State\ProviderInterface;
22
use ApiPlatform\Util\RequestParser;
23

24
final class QueryParameterValidateProvider implements ProviderInterface
25
{
26
    public function __construct(private readonly ProviderInterface $decorated, private readonly QueryParameterValidator $queryParameterValidator)
27
    {
28
    }
61✔
29

30
    public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|array|null
31
    {
32
        if (
33
            !$operation instanceof HttpOperation
61✔
34
            || !($request = $context['request'] ?? null)
61✔
35
            || !$request->isMethodSafe()
61✔
36
            || 'GET' !== $request->getMethod()
61✔
37
        ) {
38
            return $this->decorated->provide($operation, $uriVariables, $context);
6✔
39
        }
40

41
        if (!($operation->getQueryParameterValidationEnabled() ?? true) || !$operation instanceof CollectionOperationInterface) {
55✔
42
            return $this->decorated->provide($operation, $uriVariables, $context);
38✔
43
        }
44

45
        $queryString = RequestParser::getQueryString($request);
19✔
46
        $queryParameters = $queryString ? RequestParser::parseRequestParams($queryString) : [];
19✔
47
        $class = $operation->getClass();
19✔
48
        if (($options = $operation->getStateOptions()) && $options instanceof Options && $options->getEntityClass()) {
19✔
49
            $class = $options->getEntityClass();
×
50
        }
51

52
        $this->queryParameterValidator->validateFilters($class, $operation->getFilters() ?? [], $queryParameters);
19✔
53

54
        return $this->decorated->provide($operation, $uriVariables, $context);
19✔
55
    }
56
}
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