-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Twig templates & Doctrine proxy object - symfony 2.2.0-RC2 #7122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Can you copy/paste your entities ? And also show us your controller that retrieve the item ? |
In previous example I tried to simplify things. This is the real entities. User Entity: https://gist.github.com/dalibor983/4985875 CityDefinition Entity: https://gist.github.com/dalibor983/4985914 XML mappings for this two entities: https://gist.github.com/dalibor983/4985919 Controller code $username = <some_username>;
$manager = $this->getDoctrine()->getManager();
$r = $manager->getRepository('<some_bundle>:User');
/* @var User $user */
$user = $r->findOneBy(array('loginUsername' => $username));
return $this->render('<some_twig>', array(
'userData' => $user,
)); Twig consists
|
@dalibor983 Could you move this code to gist? It makes this issue really unreadable... |
The code above works in simfony 2.1 but not in 2.2.0RC2. I'm trying to upgrade from 2.1 to 2.2.0RC2 |
I updated my post with gist links. |
I also use this in twig template:
and in "ExampleController:index" i have public function indexAction($<
8000
/span>cityDef)
{
$this->render(<some_twig>, array("cityDef" => $cityDef));
} and in twig
I also get error. |
I noticed that this twig call:
transformed "userData.cityDefinition" proxy object to array with one element "isInitialized => '1'" and |
See issue #7124 |
If you have for example "Item" entity with many to one relation between them and "Group" entity. In "Item" entity "group" parameter represents "Group" entity where it belongs with getter "getGroup" and setter "setGroup". "Group" consists "title" parameter with getter "getTitle" and setter "setTitle"
In controller for example you find one item with item id and pass that item to twig template as variable "item". In "item" object "group" parameter is now doctrine proxy object.
If you try to do this in twig template
you will get this error
Only parameter that twig can access in "item.group" object is "isInitialized".
The text was updated successfully, but these errors were encountered: