Skip to content

Commit

Permalink
Fix compatibility with Symfony 3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
enumag committed Dec 8, 2016
1 parent 5344753 commit df8decd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"arachne/codeception": "^0.7.3",
"arachne/csrf": "^0.1.0",
"arachne/property-access": "^0.1.0",
"arachne/twig": "^0.1.0",
"arachne/twig": "^0.2.0",
"codeception/codeception": "~2.2.0",
"enumag/application": "^0.3.5",
"kdyby/annotations": "^2.2.0",
Expand Down
20 changes: 19 additions & 1 deletion src/DI/FormsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,27 @@ public function loadConfiguration()
->setClass('Symfony\Bridge\Twig\Extension\FormExtension')
->addTag(TwigExtension::TAG_EXTENSION);

try {
$reflections = (new \ReflectionClass('Symfony\Bridge\Twig\Extension\FormExtension'))
->getMethod('__construct')
->getParameters();

foreach ($reflections as $reflection) {
if ($reflection->getName() === 'renderer' && $reflection->allowsNull()) {
$builder->getDefinition($this->prefix('twig.extension.form'))
->setArguments([
'renderer' => null,
]);
break;
}
}
} catch (\ReflectionException $e) {
}

$builder->addDefinition($this->prefix('twig.renderer'))
->setClass('Symfony\Bridge\Twig\Form\TwigRendererInterface')
->setFactory('Arachne\Forms\Twig\TwigRenderer');
->setFactory('Arachne\Forms\Twig\TwigRenderer')
->addTag(TwigExtension::TAG_RUNTIME, 'Symfony\Bridge\Twig\Form\TwigRenderer');

$builder->addDefinition($this->prefix('twig.engine'))
->setClass('Symfony\Bridge\Twig\Form\TwigRendererEngineInterface')
Expand Down

0 comments on commit df8decd

Please sign in to comment.