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

api-platform / core / 20133637470

11 Dec 2025 12:48PM UTC coverage: 25.196% (-0.002%) from 25.198%
20133637470

push

github

web-flow
fix(symfony): do not load docs routes if docs disabled (#7448)

Co-authored-by: soyuka <soyuka@users.noreply.github.com>

0 of 18 new or added lines in 4 files covered. (0.0%)

14335 existing lines in 465 files now uncovered.

14578 of 57859 relevant lines covered (25.2%)

28.9 hits per line

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

100.0
/src/State/Processor/ObjectMapperProcessor.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\State\Processor;
15

16
use ApiPlatform\Metadata\Operation;
17
use ApiPlatform\State\ProcessorInterface;
18
use Symfony\Component\HttpFoundation\Response;
19
use Symfony\Component\ObjectMapper\ObjectMapperInterface;
20

21
/**
22
 * @implements ProcessorInterface<mixed,mixed>
23
 */
24
final class ObjectMapperProcessor implements ProcessorInterface
25
{
26
    /**
27
     * @param ProcessorInterface<mixed,mixed> $decorated
28
     */
29
    public function __construct(
30
        private readonly ?ObjectMapperInterface $objectMapper,
31
        private readonly ProcessorInterface $decorated,
32
    ) {
UNCOV
33
    }
715✔
34

35
    public function process(mixed $data, Operation $operation, array $uriVariables = [], array $context = []): object|array|null
36
    {
UNCOV
37
        $class = $operation->getInput()['class'] ?? $operation->getClass();
46✔
38

39
        if (
UNCOV
40
            $data instanceof Response
46✔
UNCOV
41
            || !$this->objectMapper
46✔
UNCOV
42
            || !$operation->canWrite()
46✔
UNCOV
43
            || null === $data
46✔
UNCOV
44
            || !is_a($data, $class, true)
46✔
UNCOV
45
            || !$operation->canMap()
46✔
46
        ) {
UNCOV
47
            return $this->decorated->process($data, $operation, $uriVariables, $context);
40✔
48
        }
49

UNCOV
50
        $request = $context['request'] ?? null;
6✔
UNCOV
51
        $persisted = $this->decorated->process(
6✔
52
            // maps the Resource to an Entity
UNCOV
53
            $this->objectMapper->map($data, $request?->attributes->get('mapped_data')),
6✔
UNCOV
54
            $operation,
6✔
UNCOV
55
            $uriVariables,
6✔
UNCOV
56
            $context,
6✔
UNCOV
57
        );
6✔
58

UNCOV
59
        $request?->attributes->set('persisted_data', $persisted);
6✔
60

61
        // return the Resource representation of the persisted entity
UNCOV
62
        return $this->objectMapper->map(
6✔
63
            // persist the entity
UNCOV
64
            $persisted,
6✔
UNCOV
65
            $operation->getClass()
6✔
UNCOV
66
        );
6✔
67
    }
68
}
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