Check if there's a _route request attribute before getting it

Apparently Symfony doesn't add a _route parameter to subrequests (esi render call) so PropelParamConverter throw an error accessing getOption method on not-existent object on line 98.
This commit is contained in:
Chris 2013-09-25 12:09:42 +02:00
parent 2c0342f927
commit c2a3c3082d

View file

@ -94,7 +94,7 @@ class PropelParamConverter implements ParamConverterInterface
$options = $configuration->getOptions();
// Check route options for converter options, if there are non provided.
if (empty($options) && $this->router && $configuration instanceof ParamConverter) {
if (empty($options) && $request->attributes->has('_route') && $this->router && $configuration instanceof ParamConverter) {
$converterOption = $this->router->getRouteCollection()->get($request->attributes->get('_route'))->getOption('propel_converter');
if (!empty($converterOption[$configuration->getName()])) {
$options = $converterOption[$configuration->getName()];