Skip to content

Empty class from the definition of the service #957

Closed

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 !

Activity

  1. added a commit that references this issue on Oct 4, 2019
    97e2f99
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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