Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After upgrading symfony from 3.4 to 4.4(without flex) getting The \"tactician.commandbus\" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead #132

Open
vasanth-kumar-m-y opened this issue Jun 17, 2022 · 0 comments

Comments

@vasanth-kumar-m-y
Copy link

vasanth-kumar-m-y commented Jun 17, 2022

Hi
After updating symfony from 3.4 to 4.4(without flex) i am getting this error The "tactician.commandbus" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead

symfony (4.4.42)
league/tactician-bundle (v1.4.0)

have injected commnd bus using DI in Controller

class MngmtController extends AbstractFOSRestController
{
   /**
     * @var CommandBus
     */
    private $commandBus;

    /**
     * @var CommandBus
     */
    private $mngmtCommandBus;

    /**
     * @var MngmtService
     */
    private $mngmtService;

    /**
     * @var LoggerInterface
     */
    private $logger;

    /**
     * @param ContainerInterface $container
     * @param CommandBus         $commandBus
     * @param CommandBus         $mngmtCommandBus
     * @param MngmtService       $mngmtService
     * @param LoggerInterface    $logger
     *
     * @DI\InjectParams({
     *     "container" = @DI\Inject("service_container"),
     *     "commandBus" = @DI\Inject("tactician.commandbus"),
     *     "mngmtCommandBus" = @DI\Inject("tactician.commandbus.mngmt"),
     *     "mngmtService" = @DI\Inject("app.services.mngmt_service"),
     *     "logger" = @DI\Inject("logger")
     * })
     */
    public function __construct(
        ContainerInterface $container,
        CommandBus $commandBus,
        CommandBus $mngmtCommandBus,
        MngmtService $mngmtService,
        LoggerInterface $logger
    ) {
        $this->container = $container;
        $this->commandBus = $commandBus;
        $this->mngmtCommandBus = $mngmtCommandBus;
        $this->mngmtService = $mngmtService;
        $this->logger = $logger;
    }

command and handler mapping in Handler

/**
 * Class UpdateMngmtCommandHandler.
 *
 * @DI\Service("app.update_mngmt_command_handler")
 * @DI\Tag("tactician.handler", attributes= {"command" = "AppBundle\CommandBus\UpdateMngmtCommand"})
 */
class MngmtCommandHandler {

middleware configuraion in config.yml

 tactician:
    commandbus:
        default:
            middleware:
                - tactician.middleware.locking
                - tactician.middleware.doctrine
                - tactician.middleware.command_handler
        mngmt:
            middleware:
                - tactician.middleware.locking
                - app.commandbus.middleware.lock_component
                - app.commandbus.middleware.transaction
                - app.commandbus.middleware.mngmt_block
                - tactician.middleware.command_handler
@vasanth-kumar-m-y vasanth-kumar-m-y changed the title After upgrading symfony from 3.4 to 4.4 getting The \"tactician.commandbus\" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead After upgrading symfony from 3.4 to 4.4(without flex) getting The \"tactician.commandbus\" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant