Skip to content

do not rename the template in dynamic router #388

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
Feb 10, 2017
Merged

Conversation

dbu
Copy link
Member

@dbu dbu commented Feb 6, 2017

$template is in line with the FrameworkBundle TemplateController

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

together with symfony-cmf/content-bundle#174

@ElectricMaxxx
Copy link
Member

Doing so all custom controllers, should call its template parameter $template, right? I thought we have some kind of configuration here to be flexible.

@dbu dbu force-pushed the not-rename-template branch from 4614b4b to 1f21a67 Compare February 6, 2017 08:29
@dbu
Copy link
Member Author

dbu commented Feb 6, 2017

they have to, if they want parameter automatch. but i think its worth it to avoid the collision with FrameworkBundle. we don't have configuration for that name, only a constant - but a parameter variable name can't use a constant afaik. however, you could write your controller expecting the Request instead, and then get the attribute with the constant...

@wouterj
Copy link
Member

wouterj commented Feb 7, 2017

A couple of remarks here:

  • Why at all do this renaming of _template to contentTemplate?
  • How can this conflict with the framework's template controller? It'll always require template, not _template.
  • Why remove _template when renaming it to contentTemplate? Does it hurt having a duplicated request attribute?
  • If we want to do this change, we should release a new 1.4 version that triggers a deprecation warning when using contentTemplate. It should also come with 2 attributes: template and contentTemplate to allow forward compatibility.

UPGRADE-2.0.md Outdated
```php
public function documentAction($contentDocument, $template) {
...
```
Copy link
Member

Choose a reason for hiding this comment

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

this file doesn't seem right. The lines 208 - 222 should be removed, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

indeed, messed up with copy-pasting it seems.

@dbu
Copy link
Member Author

dbu commented Feb 8, 2017 via email

@wouterj
Copy link
Member

wouterj commented Feb 9, 2017

Let's update this PR to use both contentTemplate and template in 2.0. We then have more time to see how we can trigger deprecations for the contentTemplate (and I believe we should propose to stop throwing an exception when _template is present, it doesn't hurt anybody See sensiolabs/SensioFrameworkExtraBundle#459).

@dbu
Copy link
Member Author

dbu commented Feb 9, 2017

yeah, i was going to say thats not our fault :-)

@dbu dbu force-pushed the not-rename-template branch 3 times, most recently from a93071f to 65784fb Compare February 9, 2017 21:16
@dbu
Copy link
Member Author

dbu commented Feb 9, 2017

i think this is now ready

* This name is deprecated in favor of "template" for consistency with
* FrameworkBundle and will be removed in RoutingBundle 3.
*/
const BC_CONTENT_TEMPLATE = 'contentTemplate';
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we have to use a constant for the BC version, it'll only cause more conflicts (people shouldn't start using this constant)

@wouterj wouterj force-pushed the not-rename-template branch from 65784fb to d46874e Compare February 9, 2017 22:59
@wouterj
Copy link
Member

wouterj commented Feb 9, 2017

Applied my comment and slightly tweaked the changelog and upgrade guide. Feel free to merge if you agree with my changes.

$template is in line with the FrameworkBundle TemplateController
@wouterj wouterj force-pushed the not-rename-template branch from d46874e to 8ebb686 Compare February 9, 2017 23:00
@wouterj wouterj merged commit 23631d7 into master Feb 10, 2017
@wouterj wouterj removed the wip/poc label Feb 10, 2017
@wouterj wouterj deleted the not-rename-template branch February 10, 2017 14:40
@dbu
Copy link
Member Author

dbu commented Feb 10, 2017

good point, thanks for the cleanup and the merge!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants