namespace xx\UserBundle\Entity;useDoctrine\ORM\Mapping as ORM;/** * @ORM\Entity **/classUser{###...###}
FileBundle is very similar.. Thanks!
回答1:
You are mixing Doctrine mapping formats, you have annotations and at least one XML file in Resources/config/doctrine
From the symfony docs:
"A bundle can accept only one metadata definition format. For example, it's not possible to mix YAML metadata definitions with annotated PHP entity class definitions."
So the solution is:
You cannot mix different Doctrine mapping formats in a given bundle. So either use annotations for all entities or use XML for all.
回答2:
It is somehow strange to me that you're using PHPDriver for ORM and not AnnotationDriver, since your database info in classes is in annotations.
Anyhow, if php app/console doctrine:mapping:info command gives you only 1 entity that means that your other bundle containing User class is not loaded in app/AppKernel.php file. Load your UserBundle by adding line
new xxx\UserBundle\xxxUserBundle(),
to the $bundles array in registerBundles() function. After that, this function should look something like this: