Symfony 4 autowiring not working properly

Here is the context:

  1. Installed beanstalk bundle with composer “composer require leezy/pheanstalk-bundle”

  2. I’m trying to using inside a command but i get this error

Cannot autowire service “AppCommandWorkerProcessParserCommand”: argument “$pheanstalk” of method “__construct()” references interface “PheanstalkContractPheanstalkInterface” but no such
service exists. You should maybe alias this interface to the existing “leezy.pheanstalk.proxy.default” service.

class ProcessParserCommand extends Command
{
    protected static $defaultName = 'app:worker:process-parser';

    /** @var PheanstalkInterface $pheanstalk */
    private $pheanstalk;

    protected function configure()
    {
        $this
            ->setDescription("Parse something")
        ;
    }



    public function __construct(PheanstalkInterface $pheanstalk)
    {
        $this->pheanstalk=$pheanstalk;

        parent::__construct();
    }
}

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *