So I'm trying to follow symfony2's tutorial on doctrine for my own website and modeling my User
entity after their Product
one.
Also, before anyone marks this a duplicate, I have already tried the solutions given in numerous other questions with no luck:
- Not a valid entity or mapped super class
- Doctrine class is not a valid entity or mapped super class
- Symfony/Doctrine: Class is not a valid entity or mapped super class
- symfony2 is not a valid entity or mapped super class
- Symfony/Doctrine: Class is not a valid entity or mapped super class
- "Class XXX is not a valid entity or mapped super class" after moving the class in the filesystem
and the list goes on
I have my entity class:
<?php
namespace MySite\MyBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="user")
*/
class User
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="string", length=100)
*/
protected $name;
/**
* @ORM\Column(type="string", length=64)
*/
protected $password;
}
?>
Now, I'm running the command:
$ php app/console doctrine:generate:entities MySite/MyBundle/Entity/User
to generate the accessor methods. However, when I do this, I get the error:
[Doctrine\ORM\Mapping\MappingException]
Class "MySite\MyBundle\Entity\User" is not a valid entity or mapped super class.
auto_mapping: true
line in my config.yml; everything works as expected now. – user2443357