Skip to content

[TwigBundle] Move template.xml loading to a compiler pass #23186

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

Merged
merged 1 commit into from
Jun 15, 2017
Merged

[TwigBundle] Move template.xml loading to a compiler pass #23186

merged 1 commit into from
Jun 15, 2017

Conversation

ogizanagi
Copy link
Contributor

@ogizanagi ogizanagi commented Jun 14, 2017

Q A
Branch? 2.7
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #23181
License MIT
Doc PR N/A

(failures unrelated)

*/
public function process(ContainerBuilder $container)
{
if (!interface_exists(EngineInterface::class) || !$container->hasAlias('templating')) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've kept the interface_exists check as a safe guard, in case another templating alias exists in userland/third party bundle (probably unlikely, but still).

We could also get the framework configuration and process it back to get the $config['templating']['enabled] value, but not sure it's worth it.

@ogizanagi
Copy link
Contributor Author

ogizanagi commented Jun 14, 2017

Oh. Actually, it fixes a bug in 3.3 with the AbstractController, but it could also be applicable in lower branches. WDYT?

@chalasr
Copy link
Member

chalasr commented Jun 14, 2017

If framework.templating is disabled and the templating.engine.twig service is registered then its definition is invalid, I think it's worth fixing it on lower branches.

@ogizanagi
Copy link
Contributor Author

ogizanagi commented Jun 15, 2017

Problem is that we must ensure the TwigBundle TemplatingPass is executed before the FrameworkBundle one, hence using the 3.2 compiler pass priority feature.

So we'll need to act differently for lower branches: instead of differing the loading of the templating.xml file in a pass, we should remove the two twig.loader.filesystem and templating.engine.twig in the ExtensionPass, where some similar operations are made.

For now, rebased on 3.2 at least.

@ogizanagi ogizanagi changed the base branch from 3.3 to 3.2 June 15, 2017 08:45
@nicolas-grekas nicolas-grekas modified the milestones: 3.2, 2.7 Jun 15, 2017
@ogizanagi ogizanagi changed the base branch from 3.2 to 2.7 June 15, 2017 11:48
@ogizanagi
Copy link
Contributor Author

Re-targeted to 2.7.

Copy link
Member

@chalasr chalasr left a comment

Choose a reason for hiding this comment

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

👍 Maybe a test/comment would be good to prevent regressions

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

👍

@fabpot
Copy link
Member

fabpot commented Jun 15, 2017

Thank you @ogizanagi.

@fabpot fabpot merged commit 6ac0de8 into symfony:2.7 Jun 15, 2017
fabpot added a commit that referenced this pull request Jun 15, 2017
…(ogizanagi)

This PR was merged into the 2.7 branch.

Discussion
----------

[TwigBundle] Move template.xml loading to a compiler pass

| Q             | A
| ------------- | ---
| Branch?       | 2.7 <!-- see comment below -->
| Bug fix?      | yes
| New feature?  | no <!-- don't forget updating src/**/CHANGELOG.md files -->
| BC breaks?    | no
| Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->
| Tests pass?   | yes
| Fixed tickets | #23181 <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | N/A

(failures unrelated)

Commits
-------

6ac0de8 [TwigBundle] Remove template.xml services when templating is disabled
@ogizanagi ogizanagi deleted the twig/templating_pass branch June 15, 2017 14:34
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