yokai-php / sonata-workflow

Integrate Symfony workflow component in Sonata Admin
MIT License
22 stars 11 forks source link

workflow.registry service is private in sf4 #1

Closed fliespl closed 6 years ago

fliespl commented 6 years ago

The "workflow.registry" 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.

yann-eugone commented 6 years ago

Hello, Thanks for reporting this issue.

I believe that this exception was triggered from the controller. I will have a look to a clean solution during the week. As a quick fix, you can alter the workflow.registry service definition, and make it public (using a compiler pass).

fliespl commented 6 years ago

Yes, I have already done that :)

Just mentioned this issue in case you were not aware.

My solution:

<?php

namespace App;

use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;

class Kernel extends BaseKernel implements CompilerPassInterface
{
    use MicroKernelTrait;

    public function process(ContainerBuilder $container)
    {
        $container->getDefinition('workflow.registry')->setPublic(true);
    }

...
}
yann-eugone commented 6 years ago

@fliespl could you give a try to the fix :

composer require yokai/sonata-workflow:dev-issue.1-work.with.private.service.in.controller@dev

Please note that the README was updated. (Your controller must now be declared as a service).

yann-eugone commented 6 years ago

No feedback provided, just merged the PR, and released as v0.1.1