Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[TwigBundle] Fix usage of TwigBundle without FrameworkBundle #28893

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
Oct 21, 2018

Conversation

tgalopin
Copy link
Contributor

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

According to the composer.json (https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/TwigBundle/composer.json), the FrameworkBundle shouldn't be required to use the bundle (which can be useful in tests of other bundles for instance). However, it is not the case, mainly due to issues with direct references to unavailable services.

I target 3.4 because 812fbb4 is the main reason for the issue. We may have added additional problems in 4.0 and 4.1.

@tgalopin tgalopin changed the title Fix twig bundle empty add [TwigBundle] Fix usage if TwigBundle without FrameworkBundle Oct 16, 2018
@tgalopin tgalopin changed the title [TwigBundle] Fix usage if TwigBundle without FrameworkBundle [TwigBundle] Fix usage of TwigBundle without FrameworkBundle Oct 16, 2018
@stof
Copy link
Member

stof commented Oct 16, 2018

twig.runtime.httpkernel having a reference to the fragment handler service is not an issue. We should only move the twig.runtime tag to the compiler pass, as done for the extension itself. If the service does not exist, the compiler pass would not tag it as a twig runtime, and so nothing references it (and the service gets removed, and so the non-existing reference is not an issue). So I would keep the argument in the XML file, which makes it more readable when looking at the service definition.

@@ -142,7 +141,7 @@
</service>

<service id="twig.controller.preview_error" class="Symfony\Bundle\TwigBundle\Controller\PreviewErrorController" public="true">
<argument type="service" id="http_kernel" />
<argument />
Copy link
Member

Choose a reason for hiding this comment

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

that is still a broken service definition here. The compiler pass should not handle adding the argument, but should handle removing the service instead (if we don't have HttpKernel, we don't really need the error preview controller)

@nicolas-grekas nicolas-grekas added this to the 3.4 milestone Oct 17, 2018
@tgalopin tgalopin force-pushed the fix-twig-bundle-empty-add branch from 9a85049 to cad2d39 Compare October 18, 2018 09:18
@tgalopin
Copy link
Contributor Author

Updated

Copy link
Member

@fabpot fabpot left a comment

Choose a reason for hiding this comment

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

To be merged in master (no 3.4 versions worked without FrameworkBundle).

@fabpot fabpot force-pushed the fix-twig-bundle-empty-add branch from cad2d39 to 246a905 Compare October 21, 2018 06:50
@fabpot
Copy link
Member

fabpot commented Oct 21, 2018

Thank you @tgalopin.

@fabpot fabpot merged commit 246a905 into symfony:3.4 Oct 21, 2018
fabpot added a commit that referenced this pull request Oct 21, 2018
…Bundle (tgalopin)

This PR was squashed before being merged into the 3.4 branch (closes #28893).

Discussion
----------

[TwigBundle] Fix usage of TwigBundle without FrameworkBundle

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

According to the composer.json (https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/TwigBundle/composer.json), the FrameworkBundle shouldn't be required to use the bundle (which can be useful in tests of other bundles for instance). However, it is not the case, mainly due to issues with direct references to unavailable services.

I target 3.4 because 812fbb4 is the main reason for the issue. We may have added additional problems in 4.0 and 4.1.

Commits
-------

246a905 [TwigBundle] Fix usage of TwigBundle without FrameworkBundle
@fabpot
Copy link
Member

fabpot commented Oct 21, 2018

And you got it in 3.4 as I forgot to switch the branch when merging :)

This was referenced Nov 3, 2018
@tgalopin tgalopin deleted the fix-twig-bundle-empty-add branch November 3, 2018 12:43
@fabpot fabpot mentioned this pull request Nov 3, 2018
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