You will be able to retreive it through the dictionaries collection service:
$dictionaries = $container->get(\Knp\DictionaryBundle\Dictionary\Collection::class);
$dictionary = $dictionaries['my_dictionary'];
Is there a way to inject a dictionary into a service, like Workflows? That is, if I want to inject a specific workflow into a service
public function __construct(private Symfony\Component\Workflow\WorkflowInterface $projectStateMachine)
what I'm currently doing is injecting the whole collection and extracting the one I want
private Dictionary $voteDictionary;
public function __construct(
private Dictionary\Collection $dictionaryCollection,
)
{
$this->voteDictionary = $this->dictionaryCollection['vote'];
What I'd like to do is
public function __construct(private DictionaryInterface $voteDictionary)
That is, bin/console debug:container dictionary would also show how to inject a specific dictionary. I don't think this is possible now, but if someone can point me in the right direction as to how to do this, maybe I can add it. Thanks.
You will be able to retreive it through the dictionaries collection service:
Is there a way to inject a dictionary into a service, like Workflows? That is, if I want to inject a specific workflow into a service
what I'm currently doing is injecting the whole collection and extracting the one I want
What I'd like to do is
That is, bin/console debug:container dictionary would also show how to inject a specific dictionary. I don't think this is possible now, but if someone can point me in the right direction as to how to do this, maybe I can add it. Thanks.