Skip to content
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

[TwigBundle] Fix usage of TwigBundle without FrameworkBundle #28893

Merged
merged 1 commit into from Oct 21, 2018

Conversation

Projects
None yet
5 participants
@tgalopin
Copy link
Member

commented Oct 16, 2018

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

This comment has been minimized.

Copy link
Member

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 />

This comment has been minimized.

Copy link
@stof

stof Oct 16, 2018

Member

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 tgalopin:fix-twig-bundle-empty-add branch from 9a85049 to cad2d39 Oct 18, 2018

@tgalopin

This comment has been minimized.

Copy link
Member Author

commented Oct 18, 2018

Updated

@fabpot

fabpot approved these changes Oct 21, 2018

Copy link
Member

left a comment

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

@fabpot fabpot force-pushed the tgalopin:fix-twig-bundle-empty-add branch from cad2d39 to 246a905 Oct 21, 2018

@fabpot

This comment has been minimized.

Copy link
Member

commented Oct 21, 2018

Thank you @tgalopin.

@fabpot fabpot merged commit 246a905 into symfony:3.4 Oct 21, 2018

1 of 3 checks passed

continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
fabbot.io Your code looks good.
Details

fabpot added a commit that referenced this pull request Oct 21, 2018

feature #28893 [TwigBundle] Fix usage of TwigBundle without Framework…
…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

This comment has been minimized.

Copy link
Member

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 tgalopin:fix-twig-bundle-empty-add branch Nov 3, 2018

@fabpot fabpot referenced this pull request Nov 3, 2018

Merged

Release v4.2.0-BETA1 #29073

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.