Le 14/04/2011 08:15, noRerih a écrit :
Hi all, I use Sf2 vPR11 and have just created database, generated
entity, created schema. Now the question is: how can I access and
manipulate model from controller?

Official docs (http://symfony.com/doc/2.0/book/doctrine/orm/
overview.html) provide following example:
         $user = new User();
         $user->setName('Jonathan H. Wage');

         $em = $this->get('doctrine.orm.entity_manager');
         $em->persist($user);
         $em->flush();

It's not very clear why should entity manager be used, and what is it,
etc. But ok, I tried to do this with my values from config:
        $em =  $this->get('doctrine.orm.entity_managers.default');

and got an error page with "The service
"doctrine.orm.entity_managers.default" does not exist."

What should I do to manipulate model, and does anyone know if there's
way to do it without middle-layer (entity manager).

Any help is appreciated, thanks in advance.

The name og the service for the entity manager named "default" is doctrine.orm.default_entity_manager doctrine.orm.entity_manager is an alias for the one declared as default (which is probably the only one you defined)

--
Christophe | Stof

--
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to