symfony/mercure

Hubinterface in command

rickerd opened this issue · 2 comments

I've got a command that relies on the HubInterface from mercure.
Luckily I can use this in dev mode but when going to production the HubInterface is gone and not injectable.

I have no clue why this cannot be done since it does work in dev mode.

services.yaml

        class: App\Command\PlannedLotteryDrawsCommand
        arguments: [ '@lottery.subscriberhelper', '@service_container', '@mercure.hub.default.traceable.inner' ]
        tags:
            - { name: console.command }

PlannedLotteryCommand.php

    {
        parent::__construct();
        $this->lotterySubscriberHelper = $lotterySubscriberHelper;
        $this->container = $container;
        $this->hub = $hub;
    }

The mercure.hub.default.traceable.inner is an internal debug service, only available in dev.

Use mercure.hub.default instead, or, better, rely on autowiring.

I used this; @symfony\Component\Mercure\HubInterface