I had an entity class in Aib\PlatformBundle\Entity\User.php
I had no problems trying to create its form class through
php app/ console doctrine:generate:form AibPlatformBundle:User
Now I have change the namespace to Aib\PlatformBundle\Entity\Identity\User, but when I try to generate the form with the task I said before it says:
"Class Aib\PlatformBundle\Entity\User is not a valid entity or mapped super class."
This is the file content:
<?php
namespace Aib\PlatformBundle\Entity\Identity;
use Doctrine\ORM\Mapping as ORM;
/**
* Aib\PlatformBundle\Entity\Identity\User
*
* @ORM\Table()
* @ORM\Entity(repositoryClass="Aib\PlatformBundle\Entity\Identity
\UserRepository")
*/
class User
{
...
Any idea?
symfony2.0.4
I resolved the same exception by deleting a conflicting autogenerated orm.php file in the bundle's Resources/config/doctrine folder; according to the documentation: "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."
I resolved this issue by setting
$useSimpleAnnotationReader=false
when creating theMetaDataConfiguration
.In my case the problem was solved by changing my servers cache from eAccelerator to APC. Apparently eAccelerator strips all the comments from files which breaks your annotations.
Had this problem yesterday and found this thread. I created the entity with the mapping in a new bundle (e.g. MyFooBundle/Entity/User.php), did all the configuration according to the docs but got the same error from above when trying to load the app.
In the end I realized that I wasn't loading MyFooBundle in AppKernel:
A great way to debug this is to run this command:
big thx to Mark Fu and mogoman
I knew it had to be somewhere in the config.yml... and being able to test it against the
really helped!
In fact, this command just simply stops at an error... no feedback, but when everything is fine you should be able to see all your entities listed.
Had this problem - don't forget the annotation
* @ORM\Entity
like below: