Skip to content

[FrameworkBundle] ConfigDumpReferenceCommand is not recognizing container extensions loaded via kernel #47623

Closed
@simonchrz

Description

@simonchrz

Description

Symfony\Bundle\FrameworkBundle\Command\ConfigDumpReferenceCommand do not use the existing container generated by the kernel to find container extensions. This leads to an issue dumping config references for container extensions not loaded via an (old) bundle but via the kernel.

Example

I've added a container extension on my Kernel->build() function via...

protected function build(ContainerBuilder $container): void
{
    $container->registerExtension(new MytestExtension());
}

Now i want to dump the configuration references via...

bin/console debug:config mytest
and
bin/console config:dump-reference mytest

but i get the error output

No extensions with configuration available for "mytest".

After some debugging i found out, that Symfony\Bundle\FrameworkBundle\Command\ConfigDumpReferenceCommand uses a findExtension() function from Symfony\Bundle\FrameworkBundle\Command\AbstractConfigCommand which loads available container extensions just for bundles in the initializeBundles() function.

Some steps back i found out, that i have to implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface and Symfony\Component\DependencyInjection\Extension\ConfigurationExtensionInterface on my Kernel so my extension is loaded directly via my Kernel->getConfiguration() function.

Questions
Wouldn't it be possible to easily use the existing container (which includes my extension) build by the kernel inside of AbstractConfigCommand so my kernel don't have to implement those interfaces ?

...or at least add the kernel->build() call to the initializeBundles() function ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions