Skip to content

Empty class from the definition of the service #957

Closed
@NicolasGuilloux

Description

@NicolasGuilloux

Hello there !

I noticed a small bug about service definition in your bundle. If I declare an autowired service from Symfony 3.4, I must set the class parameter because of the BuildTopicSubscriberRoutesPass that needs it.

In fact, when autowiring/autoconfiguring services actually works, but the class value of the definition is set to null if not explicitly declared.

Here is a small example:

App\Bundle\RestBundle\Processor\GalaxyRecordProcessor:
    # class: App\Bundle\RestBundle\Processor\GalaxyRecordProcessor
    tags: { name: enqueue.topic_subscriber }

that produces the following error:

In BuildTopicSubscriberRoutesPass.php line 42:
                                              
  The processor class "" could not be found.

So the CompilerPass tries to get an empty class because it does not understand that the service name is actually the class. A small fix would be to replace this line:

$processorClass = $processorDefinition->getClass();

by this:

$processorClass = $processorDefinition->getClass() ?? $serviceId;

I'll make a PR as soon as possible (Oh my god ! That docker-compose up -d is killing me ! :p)

PS: Same thing for BuildCommandSubscriberRoutesPass by the way ;)

Cheers guys !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions