Symfony 1.4 - Updating an action variable from component
I've got a scenario where I need to manipulate a variable on my action controller from within the component.
Basically, I have a component where I'm executing some Doctrine Queries and then outputting them in a component file. In my action method I call this component to send it back to th开发者_JAVA技巧e browser (the request is made via AJAX)
$content = $this->getComponent('documents', 'list');
What I want to do is access the row count of the queries executed in the component method, but from within the action method. I have tried defining my variable in the action:
$this->rowCount = 0;
and then updating it in the component:
$this->rowCount = 10;
but when I var_dump
the rowCount in the action after retrieving the component content, it's still 0.
Has anyone ever done this before?
Storing the value in the parameterHodler
will do the job
See : http://www.symfony-project.org/book/1_0/02-Exploring-Symfony-s-Code#chapter_02_sub_parameter_holders
精彩评论