Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,11 +107,11 @@ public function render($controller, array $options = array()) | |
|
||
// enforce all attribute values to be scalars to be sure that the same | ||
// render() call will work with or without a reverse proxy | ||
foreach ($options['attributes'] as $key => $value) { | ||
if (!is_scalar($value)) { | ||
throw new \InvalidArgumentException(sprintf('Unable to render the "%s" controller as the "%s" attribute is not a scalar.', $controller, $key)); | ||
array_walk_recursive($options['attributes'], function ($value) use ($controller) { | ||
if (is_object($value)) { | ||
throw new \InvalidArgumentException(sprintf('Unable to render the "%s" controller as one of the attribute is an object.', $controller)); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
asm89
Contributor
|
||
} | ||
} | ||
}); | ||
|
||
if (!is_array($options['alt'])) { | ||
$options['alt'] = array($options['alt']); | ||
|
9 comments
on commit 789d5ad
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rendering an action with an object in attributes from Twig is not working anymore (http://symfony.com/doc/2.0/book/templating.html#embedding-controllers).
{% render "AcmeArticleBundle:Article:recentArticles" with {'category': category} %}
If it is a normal result, what is the best way to call an action with an object in attributes?
Thanks and regards,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RapotOR this is exactly what this change is about as using objects makes it impossible to switch the render tag to use ESI (the ESI request needs to pass the attributes through an url)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the check be activated only when standalone
is true ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no as the goal is to make it behave the same in both cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be cool if param converters could work in reverse there, so that if you pass app.user
for example, it is transformed to its identifier, and then transformed again by the param converter. Just throwing the idea out there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If i am not wrong, the problems happens in WebProfilerBundle. An exception object is given to an action.
https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/exception.html.twig#L28
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Seldaek yeah i think it would be a nice touch if we can give some assistance there ..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, this commit also broke WebProfilerBundle as already found out by @RapotOR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to revert the whole thing because there are legitimate uses of passing an object directly like exception management.
This is BC break, as before this we can put i.e. an
Request
object as a param (which AFAIK is possible when normally using Controllers), now we need to hack around.