-
-
Notifications
You must be signed in to change notification settings - Fork 315
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
[TwigComponent] Configuration with PHP ConfigBuilders fails #1304
Comments
Normally, the TwigComponentConfig class is generated in your var/cache/dev/Symfony/Config directory... is that not the case ? |
@smnandre It is. But clearing the cache crashes. Just to be safe that not something else in my app is wrong, I just set up a clean v6.3 skeleton+webapp project and added ux-twig-component. Then I replaced
Then I ran
|
Ok i see the problem and reproduced, thanks for the details :) I'd like to have @weaverryan and @kbond inputs.. because we could either add a Configuration class as you suggested, or keep a single Extension class and move things a bit to implement ConfigurableExtension, but i'm not sure what is the best way forward ? (i personnaly like the separated Configuration classes) |
In the Extension, we just have to add this method and everything seems to work // src/DependencyInjection/TwigComponentExtension.php
final class TwigComponentExtension extends Extension implements ConfigurationInterface
{
// ...
public function getConfiguration(array $config, ContainerBuilder $container): ConfigurationInterface
{
return $this;
} Can you confirm it works for you @rarila ? |
@smnandre Works! 👍 Looks like I’m the only one using ConfigBuilders 😄 |
@rarila do you use other UX Packages ? 👼 You may be the only one... but you are a great beta-tester :) |
I use configuration with PHP ConfigBuilders and tried to add configuration for symfony/ux. That failed,
TwigComponentConfig
could not be loaded.So I was digging around (not knowing anything about it), comparing how others do it and finally found a working solution:
I created
ux/src/TwigComponent/src/DependencyInjection/Configuration.php
with content like this
and then moved the
getConfigTreeBuilder()
method fromux/src/TwigComponent/src/DependencyInjection/TwigComponentExtension.php
into that class.
I don’t know if this the correct way, if that would break anything else, but at least now
TwigComponentConfig
gets built and configuration works.The text was updated successfully, but these errors were encountered: