Replace $user = $em->find("User", 1); line to $user =
$em->find("ProjectName\BundleName\Entity\EntityName", 1);

Sorry for poor English.

On Sun, May 15, 2011 at 6:17 PM, Gaku <[email protected]> wrote:

> Hi there,
>
> I used Symfony2 and Doctrine2.
> But I can't use entity's annotation mapping with entity_managers.
>
> could you help me ?
>
>
> ・config.ym.
> -----------
> doctrine:
>   orm:
>       default_entity_manager: default
>       entity_managers:
>           default:
>               connection: default
>               mappings:
>                   MyBundle: { type: annotation, dir: Entity/ }
>
> -------------
>
> ・controller
> -------------
> $em = $this->get("doctrine.orm.entity_manager");
> $user = $em->find("User", 1);              <----error occured at this
> line.
> print_r($user);
> -------------
>
> In that case, entity classes is not found in the Entity folder.
> so I had error when I execute this program.
>
> ---
> Class User does not exist
> 500 Internal Server Error - ReflectionException
>
> in C:\data\eclipse_files\eclipse_php\workspace\tank\vendor\doctrine\lib
> \Doctrine\ORM\Mapping\ClassMetadata.php
> at line 67
> ---
>
> but when I don't use entity_managers and I use "auto_mapping: true",
> this error don't occured.
> I want to use entity's annotation mapping with entity_managers.
>
>
> Sorry for my English.
>
> Regards,
> Gaku
>
> --
> 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 developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/symfony-devs?hl=en
>

-- 
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 developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to