8000 [TwigBundle] do not try to register incomplete definitions by xabbuh · Pull Request #20799 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[TwigBundle] do not try to register incomplete definitions #20799

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
Dec 17, 2016

Conversation

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

{
if (!interface_exists('Symfony\Component\Templating\TemplateReferenceInterface')) {
$container->removeDefinition('twig.controller.exception');
}
Copy link
Member

Choose a reason for hiding this comment

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

This one looks wrong to me as the Exception controller only depends on Twig, not the Templating component.

Copy link
Member Author

Choose a reason for hiding this comment

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

findTemplate() returns a TemplateReferenceInterface instance: https://github.com/symfony/symfony/blob/2.7/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php#L99

Technically, this is not needed in 2.7 as the FrameworkBundle already requires the Templating component. But this check IMO is more correct as we do not rely on FrameworkBundle internals here.

Copy link
Member

Choose a reason for hiding this comment

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

This should be removed in newer versions where a string is returned though.

$container->removeDefinition('twig.controller.exception');
}

if (!class_exists('Symfony\Component\Debug\Exception\FlattenException') && !interface_exists('Symfony\Component\EventDispatcher\EventSubscriberInterface')) {
Copy link
Member

Choose a reason for hiding this comment

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

Shoudn't it be a || instead of &&

@fabpot
Copy link
Member
fabpot commented Dec 7, 2016

When merging this PR in 3.2, we should add checks for each if with the new ClassExistenceResource resource.

@nicolas-grekas nicolas-grekas added this to the 2.7 milestone Dec 7, 2016
@xabbuh
Copy link
Member Author
xabbuh commented Dec 14, 2016

ping @symfony/deciders :)

<parameters>
<parameter key="twig.extension.form.class">Symfony\Bridge\Twig\Extension\FormExtension</parameter>
<parameter key="twig.form.engine.class">Symfony\Bridge\Twig\Form\TwigRendererEngine</parameter>
<parameter key="twig.form.renderer.class">Symfony\Bridge\Twig\Form\TwigRenderer</parameter>
Copy link
Member

Choose a reason for hiding this comment

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

This parameters may know not be defined while they are before, which can be a BC break. So not god for a 2.7.x release.

Copy link
Member Author

Choose a reason for hiding this comment

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

I moved them back to the twig.xml file.

@stof
Copy link
Member
stof commented Dec 15, 2016

And regarding the extensions, we already have checks in a compiler pass. So I would rather fix them here if they are missing some condition rather than doing a second system in the DI extension itself.

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

I also moved most of the clean up logic into the compiler passes except for the twig.translation.extractor service which didn't fit well in any of the existing passes.

@HeahDude
Copy link
Contributor

This one should be good to merge now.

👍

Status: Reviewed

@fabpot
Copy link
Member
fabpot commented Dec 17, 2016

Thank you @xabbuh.

@fabpot fabpot merged commit 2c9dc66 into symfony:2.7 Dec 17, 2016
fabpot added a commit that referenced this pull request Dec 17, 2016
… (xabbuh)

This PR was merged into the 2.7 branch.

Discussion
----------

[TwigBundle] do not try to register incomplete definitions

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #20212
| License       | MIT
| Doc PR        |

Commits
-------

2c9dc66 do not try to register incomplete definitions
@xabbuh xabbuh deleted the issue-20212 branch December 17, 2016 18:57
fabpot added a commit that referenced this pull request Dec 17, 2016
…service (xabbuh)

This PR was merged into the 2.8 branch.

Discussion
----------

[TwigBundle] do not remove the Twig ExceptionController service

| Q             | A
| ------------- | ---
| Branch?       | 2.8
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        | follow up of #20799

Commits
-------

c9e560f do not remove the Twig ExceptionController service
xabbuh added a commit to xabbuh/symfony that referenced this pull request Dec 19, 2016
nicolas-grekas added a commit that referenced this pull request Dec 19, 2016
This PR was merged into the 3.1 branch.

Discussion
----------

[TwigBundle][#20799] fix merge

| Q             | A
| ------------- | ---
| Branch?       | 3.1
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Commits
-------

98c835d [TwigBundle][#20799] fix merge
nicolas-grekas added a commit that referenced this pull request Dec 19, 2016
* 3.1:
  Fix merge
  [TwigBundle][#20799] fix merge
nicolas-grekas added a commit that referenced this pull request Dec 19, 2016
* 3.2:
  Fix merge
  [TwigBundle][#20799] fix merge
fabpot added a commit that referenced this pull request Jan 8, 2017
…(fabpot)

This PR was merged into the 2.7 branch.

Discussion
----------

[TwigBundle] fixed usage when Templating is not installed

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | bug introduced in #20799
| License       | MIT
| Doc PR        | n/a

In #20799, the decoupling of the Templating definition means that the `twig.loader.filesystem` is not always defined, but used in Extension. So, this PR does the opposite as what was done before. Use `twig.loader.native_filesystem` by default and copy paths to `twig.loader.filesystem` when templating is used.

/cc @xabbuh

Commits
-------

6aa98d1 [TwigBundle] fixed usage when Templating is not installed
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.

6 participants
0