Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[TwigBridge] Add a runtime loader to the twig bridge to ease upgrading to 3.2+#21023

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@chalasr
Copy link
Member

@chalasrchalasr commentedDec 22, 2016
edited
Loading

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes/no
Fixed ticketsn/a
LicenseMIT
Doc PRtodo

This is related to the BC break reported in#21008 which has been introduced in#20093.

I think the BC break is acceptable since it is about bootstraping the form component with the twig bridge only, outside of the fullstack.
What I propose here is to ease upgrading by adding a simple runtime loader to the bridge, useful only when using the twig-bridge standalone.

So the upgrade would be as simple as:

use Symfony\Bridge\Twig\TwigRuntimeLoader;$twig = new Twig_Environment(...);$formEngine = new TwigRendererEngine(array('form_div_layout.html.twig'), $twig);- $twig->addExtension(new FormExtension(new TwigRenderer($formEngine, $csrfManager)));+ $twig->addExtension(new FormExtension());+ $twig->addRuntimeLoader(new TwigRuntimeLoader(array(TwigRenderer::class => new TwigRenderer($formEngine, $csrfManager)));

Instead of having to write this runtime loader yourself. UPGRADE files and documentation should be updated accordingly (with or without this PR).
Please see#21008 for details and an exemple of how this could be applied.

@chalasrchalasr changed the titleAdd a runtime loader to the twig bridge to ease upgrading to 3.2[TwigBridge] Add a runtime loader to the twig bridge to ease upgrading to 3.2+Dec 22, 2016
@chalasrchalasrforce-pushed thetwig-bridge/simple-runtime-loader branch from358e45e to7dc473cCompareDecember 22, 2016 13:23
@stof
Copy link
Member

As this class has nothing specific to Symfony, I suggest putting it in Twig itself

xabbuh and chalasr reacted with thumbs up emoji

@chalasr
Copy link
MemberAuthor

Seetwigphp/Twig#2311

@chalasrchalasr deleted the twig-bridge/simple-runtime-loader branchDecember 22, 2016 15:34
fabpot added a commit to twigphp/Twig that referenced this pull requestDec 23, 2016
… (chalasr)This PR was merged into the 1.x branch.Discussion----------Add a simple Twig_RuntimeLoaderInterface implementationNext tosymfony/symfony#21023This is related to the BC break reported insymfony/symfony#21008 which has been introduced insymfony/symfony#20093 when decoupling extensions from definitions.What I propose here is to ease the upgrade to symfony 3.2+ by adding a simple `Twig_RuntimeLoaderInterface` implementation here, useful only when using the twig-bridge outside of the symfony fullstack framework (with the Form component for instance).Upgrading would be as simple as:```diff$twig = new Twig_Environment(...);$rendererEngine = new TwigRendererEngine(array('form_div_layout.html.twig'), $twig);- $twig->addExtension(new FormExtension(new TwigRenderer($rendererEngine, $csrfTokenManager)));+ $twig->addExtension(new FormExtension());+ $twig->addRuntimeLoader(new Twig_RuntimeLoader(array(TwigRenderer::class => new TwigRenderer($rendererEngine, $csrfTokenManager)));```Instead of having to write this runtime loader yourself.Please seesymfony/symfony#21008 for details and a concrete example of how this could help.Commits-------91c8d59 Add a Twig_FactoryRuntimeLoader
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@chalasr@stof@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp