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

Skip to content

[WIP] A new Asset Component #13143

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

Closed
wants to merge 13 commits into from
Closed

Conversation

fabpot
Copy link
Member

@fabpot fabpot commented Dec 28, 2014

Q A
Bug fix? yes
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #11748, #11876, #4883
License MIT
Doc PR n/a

This PR started as an attempt to fix #11748 and at the same time, trying to decouple things and prepare 3.0 where the PHP templating engine will probably be moved outside the core framework.

But as I tried to decouple things, I realize that the asset sub-system was totally coupled to the Templating component, coupled with HttpFoundation (and the request scope), and not really well designed to start with. So, in addition to the initial goal, this PR extracts the asset sub-system into a new component that is easy to reuse (should be possible now to use the Symfony asset Twig function in Silex for instance very easily).

It's probably better to review this PR per commit.

THIS IS WORK IN PROGRESS AND THIS IS NOT FINISHED YET.

@stof
Copy link
Member

stof commented Dec 31, 2014

The service definition for the ActionsHelper and the AssetsHelper should be moved from templating_php.xml to templating.xml so that they are always loaded. Otherwise it is a BC break because the Twig extensions won't work anymore when the PHP engine is not enabled (and so cannot go in 2.7). And forcing to enable the PHP engine for these extensions to work is wrong. The fact that the Twig extension is implemented as a wrapper around the PHP helper is an implementation detail and should not force to slow down all engine calls because of the usage of the delegating engine to wrap both engines

@fabpot fabpot force-pushed the templating-changes branch 5 times, most recently from 1de547b to 09c42a9 Compare January 3, 2015 11:59
@fabpot fabpot force-pushed the templating-changes branch from 09c42a9 to 8143e01 Compare January 3, 2015 12:20
@fabpot
Copy link
Member Author

fabpot commented Jan 3, 2015

@stof: I've made some progress. It's not finished yet and still work in progress (I did not bother with tests), but you can have a look at the direction I took: I've decided to create a new component for the Asset/ part of the Templating component; it makes sense as there is no dependency between the Asset classes and the rest of the templating component. I've also added a templating.asset.packages service in assets.xml to allow it to be shared between the PHP templating engine (but it is still using the old helper for now) and Twig. Everything else should be easy enough to follow.

More to come.

@fabpot fabpot force-pushed the templating-changes branch 6 times, most recently from 0ae51ca to 4c28c2e Compare January 3, 2015 18:16
@fabpot fabpot force-pushed the templating-changes branch 4 times, most recently from 87e279c to 78cc129 Compare January 4, 2015 08:42
@fabpot fabpot changed the title [WIP] Templating changes [WIP] A new Asset Component Jan 4, 2015
@fabpot fabpot force-pushed the templating-changes branch from 78cc129 to a8c9b1b Compare January 4, 2015 09:34
@fabpot fabpot force-pushed the templating-changes branch from a8c9b1b to 686bee6 Compare January 4, 2015 10:28
fabpot added a commit that referenced this pull request Jan 4, 2015
…nsExtension (fabpot)

This PR was merged into the 2.7 branch.

Discussion
----------

[TwigBundle] removed the Container dependency on ActionsExtension

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | fixes #11876 partially
| License       | MIT
| Doc PR        | n/a

This PR removes the injection of the container into the actions extension, and decouple this extension from FrameworkBundle (it was part of #13143 but as it is now totally independent, I've created a new PR).

Commits
-------

76abf98 [TwigBundle] removed the Container dependency on ActionsExtension
fabpot added a commit that referenced this pull request Jan 4, 2015
…emplating.engines is not present (fabpot)

This PR was merged into the 2.7 branch.

Discussion
----------

[TwigBundle] always load the exception listener if the templating.engines is not present

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | fixes #11876 partially
| License       | MIT
| Doc PR        | n/a

This PR removes (partially) the dependency of TwigBundle on FrameworkBundle. If FrameworkBundle is not registered, the Twig exception listener is always registered (this change was part of #13143 but as it is now totally independent, I've created a new PR).

Commits
-------

30ba9df [TwigBundle] always load the exception listener if the templating.engines is not present
@fabpot
Copy link
Member Author

fabpot commented Jan 4, 2015

I'm going to split this PR to make it easier to review.

@fabpot fabpot closed this Jan 4, 2015
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.

2 participants