Skip to content

[DependencyInjection] legit definition seems removed #25335

Closed
@Ioni14

Description

@Ioni14
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 4.0.1

Hello,

I'm not 100% sure if this is a bug, but when I use a controller service ID in a route (not elsewhere), the RemoveUnusedDefinitionsPass removes the controller.

Example :

<!-- routes.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<routes xmlns="http://symfony.com/schema/routing"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://symfony.com/schema/routing
        http://symfony.com/schema/routing/routing-1.0.xsd">
    <route id="app.my_route" path="/" methods="GET">
        <default key="_controller">app.my_controller</default>
    </route>
</routes>
<!-- services.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
    <services>
        <service id="app.my_controller" class="App\Controller\MyController">
            <argument type="service" id="twig" />
        </service>
    </services>
</container>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions