"Class XXX is not a valid entity or mapped super class" after moving the class in the filesystem

ziiweb picture ziiweb · Oct 19, 2011 · Viewed 76.1k times · Source

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

Answer

Mike picture Mike · Mar 15, 2012

Had this problem - don't forget the annotation * @ORM\Entity like below:

/**
 * Powma\ServiceBundle\Entity\User
 *
 * @ORM\Entity
 * @ORM\Table(name="users")
 */