Not a valid entity or mapped super class Not a valid entity or mapped super class symfony symfony

Not a valid entity or mapped super class


In my case I was missing * @ORM\Entity in my class definition.

/** * @ORM\Entity * @ORM\Table(name="listtype") */class ListType{    ...}


Define the base-class as follows:

/** * @ORM\MappedSuperclass */abstract class BaseUser{    // ...}

Define the real entity:

/** * @ORM\Entity */class User extends BaseUser{    // ...}

Because you're missing the @MappedSuperclass annotation on the base-class, Doctrine throws the exception you mention.


In my case, the problem was eaccelerator because it strips out all the comments which Doctrine uses. After disabling eaccelerator it worked . You can disable your php settings or,

in the web/app_dev.php or web/app.php file.

<?php    ini_set('eaccelerator.enable', 0);    ini_set('eaccelerator.optimizer', 0);    //rest of the code.

Note: Do clear the symfony2 cache after disabling this.