Skip to content

[FrameworkBundle] Make sure one can use fragments.hinclude_default_template #35306

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
Jan 12, 2020

Conversation

Nyholm
Copy link
Member

@Nyholm Nyholm commented Jan 11, 2020

Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets
License MIT
Doc PR

Using framework.fragments.hinclude_default_template is not possible in 4.4. You will always get an exception saying:

You cannot set both "templating.hinclude_default_template" and "fragments.hinclude_default_template", please only use "fragments.hinclude_default_template".

That is because in fragment_renderer.xml we define the parameter fragment.renderer.hinclude.global_template to be an empty string, then in FrameworkExtension we are checking if it is null.

This PR do a !empty check instead. I also added a test to show the bug.

@nicolas-grekas nicolas-grekas added this to the 4.4 milestone Jan 11, 2020
@fabpot
Copy link
Member

fabpot commented Jan 12, 2020

Thank you @Nyholm.

fabpot added a commit that referenced this pull request Jan 12, 2020
…_default_template (Nyholm)

This PR was squashed before being merged into the 4.4 branch (closes #35306).

Discussion
----------

[FrameworkBundle] Make sure one can use fragments.hinclude_default_template

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

Using `framework.fragments.hinclude_default_template` is not possible in 4.4. You will always get an exception saying:

>  You cannot set both "templating.hinclude_default_template" and "fragments.hinclude_default_template", please only use "fragments.hinclude_default_template".

That is because in [fragment_renderer.xml](https://github.com/symfony/symfony/blob/4.4/src/Symfony/Bundle/FrameworkBundle/Resources/config/fragment_renderer.xml#L8) we define the parameter `fragment.renderer.hinclude.global_template` to be an empty string, then in FrameworkExtension we are checking if it is null.

This PR do a `!empty` check instead. I also added a test to show the bug.

Commits
-------

25fd665 [FrameworkBundle] Make sure one can use fragments.hinclude_default_template
@fabpot fabpot merged commit 25fd665 into symfony:4.4 Jan 12, 2020
@Nyholm Nyholm deleted the hinclude branch January 13, 2020 08:10
This was referenced Jan 21, 2020
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.

4 participants