8000 [TwigBundle] register template paths for overridden bundles by xabbuh · Pull Request #21077 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[TwigBundle] register template paths for overridden bundles #21077

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

Closed

Conversation

xabbuh
Copy link
Member
@xabbuh xabbuh commented Dec 28, 2016
Q A
Branch? 2.7
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets FriendsOfSymfony/FOSUserBundle#2376, FriendsOfSymfony/FOSUserBundle#2378
License MIT
Doc PR

Previously, paths for bundles overriding a parent bundle wouldn't have been registered with the namespace of the parent bundle. I am not completely sure if this is the best solution, so I didn't invest time to write tests confirming the fix. Will do that if we agree on this approach.

@ro0NL
Copy link
Contributor
ro0NL commented Dec 28, 2016

Duplicates #19586 i believe, ref #18563

The magic bundle initialization approach is under discussion i guess :) Still think #19646 was a good approach.

edit:
As its closed, i'd be up for assign everything we need with parameters or some synthetic service that we can access before compilation anyway. Perhaps assigning the parent/child relation can be effective.

Either way the reflection magic is a code smell... and makes BundleInterface sort of useless. It only works if we finalize Bundle::getPath and remove the interface.

if (is_dir($dir = $container->getParameter('kernel.root_dir').'/Resources/'.$bundle.'/views')) {
$this->addTwigPath($twigFilesystemLoaderDefinition, $dir, $bundle);
$reflection = new \ReflectionClass($class);
$bundleInstance = $reflection->newInstanceWithoutConstructor();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wont help virtual bundles really, imo. we need to be rock solid on this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean with a virtual bundle?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new VirtualBundle($name, $path, BundleInterface $parent)

@xabbuh
Copy link
Member Author
xabbuh commented Dec 28, 2016

Thanks for pointing me to #19586. I must have completely missed that PR. So I am closing here in favour of #19586.

@xabbuh xabbuh closed this Dec 28, 2016
@xabbuh xabbuh deleted the twig-loader-register-overridden-paths branch December 28, 2016 17:14
@Jurigag
Copy link
Jurigag commented Jan 4, 2017

Fixed fouserbundle for me. When this will be merged to 2.8 ?

@stof
Copy link
Member
stof commented Jan 4, 2017

@Jurigag this PR has not been merged at all, but closed in favour of another one

@Jurigag
Copy link
Jurigag commented Jan 4, 2017

@stof oh, right i missed @xabbuh comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0