Skip to content

Removed support for PHP templating everywhere #31800

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
Jun 4, 2019

Conversation

yceruto
Copy link
Member

@yceruto yceruto commented Jun 3, 2019

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

Ref: #21035 and 7169f4d

TODO:
Missing deprecations in 4.4 (#31800):

  • Symfony\Bundle\FrameworkBundle\Controller\TemplateController 2nd argument.
  • Symfony\Bundle\TwigBundle\CacheWarmer\TemplateCacheCacheWarmer class and service.

Labels: FrameworkBundle, TwigBundle, TwigBridge, SecurityBundle, Form, HttpKernel

Friendly ping @fabpot and @dunglas

@fabpot
Copy link
Member

fabpot commented Jun 3, 2019

@yceruto Some tests are broken with this PR.

@yceruto yceruto force-pushed the rm_templating_integration branch from 5f88db9 to 07020d0 Compare June 3, 2019 11:51
@yceruto
Copy link
Member Author

yceruto commented Jun 3, 2019

Tests are green now.


public function __construct(Environment $twig = null, EngineInterface $templating = null)
public function __construct(Environment $twig = null)
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like twig should not be optional in this class. And when twig is not installed, the TemplateController should be removed from DI.

Copy link
Member Author

@yceruto yceruto Jun 3, 2019

Choose a reason for hiding this comment

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

I agree, but for DX point of view it's better as is, because you'll get a good error message:

You can not use the TemplateController if the Twig Bundle is not available.

vs

"Too few arguments to function Symfony\Bundle\FrameworkBundle\Controller\TemplateController::__construct(), 0 passed in ...

WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree it's a little better for DX. But IMO it's not the responsiblity of the Controller do provide that.
We could just catch the instantiation error in

return $this->configureController(parent::instantiateController($class), $class);
and throw a better exception. It's even in the same namespace and the correct class to enhance DX. Then it's clear it's just for DX and we don't need to hack around it in the actual implementations.

@yceruto
Copy link
Member Author

yceruto commented Jun 3, 2019

Requires #31821

Status: Needs Work

@nicolas-grekas
Copy link
Member

Rebase unlocked.

@yceruto yceruto force-pushed the rm_templating_integration branch from 9686ff3 to 116be1f Compare June 3, 2019 21:03
@yceruto yceruto force-pushed the rm_templating_integration branch from 116be1f to d5be373 Compare June 3, 2019 21:17
@yceruto
Copy link
Member Author

yceruto commented Jun 3, 2019

(Rebased)

Status: Needs Review

Copy link
Contributor

@Tobion Tobion left a comment

Choose a reason for hiding this comment

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

Fine for me. https://github.com/symfony/symfony/pull/31800/files#r290086885 can be done in a separate PR.

if (!$this->container->has('twig')) {
throw new \LogicException('You can not use the "renderView" method if the Templating Component or the Twig Bundle are not available. Try running "composer require symfony/twig-bundle".');
throw new \LogicException('You can not use the "renderView" method if the Twig Bundle are not available. Try running "composer require symfony/twig-bundle".');
Copy link
Member

Choose a reason for hiding this comment

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

is not available

Copy link
Member

Choose a reason for hiding this comment

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

@fabpot
Copy link
Member

fabpot commented Jun 4, 2019

Thank you @yceruto.

@fabpot fabpot merged commit d5be373 into symfony:master Jun 4, 2019
fabpot added a commit that referenced this pull request Jun 4, 2019
This PR was merged into the 5.0-dev branch.

Discussion
----------

Removed support for PHP templating everywhere

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

Ref: #21035 and 7169f4d

**TODO:**
Missing deprecations in 4.4 (#31800):
 - [x] `Symfony\Bundle\FrameworkBundle\Controller\TemplateController` 2nd argument.
 - [x] `Symfony\Bundle\TwigBundle\CacheWarmer\TemplateCacheCacheWarmer` class and service.

**Labels:** `FrameworkBundle`, `TwigBundle`, `TwigBridge`, `SecurityBundle`, `Form`, `HttpKernel`

Friendly ping @fabpot and @dunglas

Commits
-------

d5be373 Removed support for PHP templating everywhere
@yceruto yceruto deleted the rm_templating_integration branch June 5, 2019 17:41
fabpot added a commit that referenced this pull request Jul 3, 2019
…ion (xabbuh)

This PR was merged into the 4.3 branch.

Discussion
----------

[FrameworkBundle] deprecate the framework.templating option

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

The config node has already been removed in the `master` branch in #31800. For DX it would have been better to have this deprecation in 4.3 (see e.g. #32120), but it's probably too late to ship this as a bugfix.

Commits
-------

ba241ce deprecate the framework.templating option
@fabpot fabpot mentioned this pull request Nov 12, 2019
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