8000 [TwigBridge] Fix upgrade/changelog notes · symfony/symfony@cfd2e44 · GitHub
[go: up one dir, main page]

Skip to content

Commit cfd2e44

Browse files
committed
[TwigBridge] Fix upgrade/changelog notes
1 parent 2de9dd1 commit cfd2e44

File tree

3 files changed

+64
-6
lines changed

3 files changed

+64
-6
lines changed

UPGRADE-3.2.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,36 @@ Serializer
133133
TwigBridge
134134
----------
135135

136-
* Deprecated the possibility to inject the Form Twig Renderer into the form
137-
extension. Inject it into the `TwigRendererEngine` instead.
136+
* Deprecated the possibility to inject the Form `TwigRenderer` into the form
137+
extension. Upgrade Twig to `^1.30` 10000 , inject the `Twig_Environment` into the `TwigRendererEngine` and load
138+
the `TwigRenderer` using the `Twig_FactoryRuntimeLoader` instead.
139+
140+
Before:
141+
142+
```php
143+
use Symfony\Bridge\Twig\Extension\FormExtension;
144+
use Symfony\Bridge\Twig\Form\TwigRenderer;
145+
use Symfony\Bridge\Twig\Form\TwigRendererEngine;
146+
147+
// ...
148+
$rendererEngine = new TwigRendererEngine(array('form_div_layout.html.twig'));
149+
$rendererEngine->setEnvironment($twig);
150+
$twig->addExtension(new FormExtension(new TwigRenderer($rendererEngine, $csrfTokenManager)));
151+
```
152+
153+
After:
154+
155+
```php
156+
$rendererEngine = new TwigRendererEngine(array('form_div_layout.html.twig'), $twig);
157+
$twig->addRuntimeLoader(new Twig_FactoryRuntimeLoader(array(
158+
Renderer::class => function () use ($rendererEngine, $csrfTokenManager) {
159+
return new TwigRenderer($rendererEngine, $csrfTokenManager);
160+
},
161+
)));
162+
$twig->addExtension(new FormExtension());
163+
```
164+
165+
* Deprecated the `TwigRendererEngineInterface` interface, will be removed in 4.0.
138166

139167
Validator
140168
---------

UPGRADE-4.0.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,36 @@ Translation
186186
TwigBridge
187187
----------
188188

189-
* The possibility to inject the Form Twig Renderer into the form extension
190-
has been removed. Inject it into the `TwigRendererEngine` instead.
189+
* Removed the possibility to inject the Form `TwigRenderer` into the form extension.
190+
Upgrade Twig to `^1.30`, inject the `Twig_Environment` into the `TwigRendererEngine` and load
191+
the `TwigRenderer` using the `Twig_FactoryRuntimeLoader` instead.
192+
193+
Before:
194+
195+
```php
196+
use Symfony\Bridge\Twig\Extension\FormExtension;
197+
use Symfony\Bridge\Twig\Form\TwigRenderer;
198+
use Symfony\Bridge\Twig\Form\TwigRendererEngine;
199+
200+
// ...
201+
$rendererEngine = new TwigRendererEngine(array('form_div_layout.html.twig'));
202+
$rendererEngine->setEnvironment($twig);
203+
$twig->addExtension(new FormExtension(new TwigRenderer($rendererEngine, $csrfTokenManager)));
204+
```
205+
206+
After:
207+
208+
```php
209+
$rendererEngine = new TwigRendererEngine(array('form_div_layout.html.twig'), $twig);
210+
$twig->addRuntimeLoader(new Twig_FactoryRuntimeLoader(array(
211+
Renderer::class => function () use ($rendererEngine, $csrfTokenManager) {
212+
return new TwigRenderer($rendererEngine, $csrfTokenManager);
213+
},
214+
)));
215+
$twig->addExtension(new FormExtension());
216+
```
217+
218+
* Removed the `TwigRendererEngineInterface` interface.
191219

192220
Validator
193221
---------

src/Symfony/Bridge/Twig/CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ CHANGELOG
55
-----
66

77
* added `AppVariable::getToken()`
8-
* Deprecated the possibility to inject the Form Twig Renderer into the form
9-
extension. Inject it on TwigRendererEngine instead.
8+
* [BC BREAK] Deprecated the possibility to inject the Form `TwigRenderer` into the form extension.
9+
Inject the `Twig_Environment` into the `TwigRendererEngine` and load the `Twig_Renderer`
10+
using the `Twig_FactoryRuntimeLoader` instead.
11+
* Deprecated the `TwigRendererEngineInterface` interface.
1012

1113
2.7.0
1214
-----

0 commit comments

Comments
 (0)
0