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

api-platform / core / 15681594877

16 Jun 2025 01:03PM UTC coverage: 21.908% (+0.03%) from 21.876%
15681594877

Pull #7213

github

web-flow
Merge 1b3ab0e56 into cff61eab8
Pull Request #7213: feat(metadata) Customize Resource & operations

39 of 101 new or added lines in 10 files covered. (38.61%)

123 existing lines in 11 files now uncovered.

11433 of 52186 relevant lines covered (21.91%)

20.97 hits per line

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

40.0
/src/Symfony/Bundle/DependencyInjection/Compiler/ResourceMutatorPass.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\Bundle\DependencyInjection\Compiler;
15

16
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
17
use Symfony\Component\DependencyInjection\ContainerBuilder;
18
use Symfony\Component\DependencyInjection\Reference;
19

20
class ResourceMutatorPass implements CompilerPassInterface
21
{
22
    public function process(ContainerBuilder $container): void
23
    {
24
        if (!$container->hasDefinition('api_platform.metadata.mutator_collection.resource')) {
2✔
NEW
25
            return;
×
26
        }
27

28
        $definition = $container->getDefinition('api_platform.metadata.mutator_collection.resource');
2✔
29

30
        $mutators = $container->findTaggedServiceIds('api_platform.resource_mutator');
2✔
31

32
        foreach ($mutators as $id => $tags) {
2✔
NEW
33
            foreach ($tags as $tag) {
×
NEW
34
                $definition->addMethodCall('addMutator', [
×
NEW
35
                    $tag['resourceClass'],
×
NEW
36
                    new Reference($id),
×
NEW
37
                ]);
×
38
            }
39
        }
40
    }
41
}
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

© 2025 Coveralls, Inc