Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The annotation @Doctrine\ORM\Mapping in class xx does not exist, or cannot be loaded

when executing php app/console doctrine:generate:entities etBundle:Users Im getting this error message:

[Doctrine\Common\Annotations\AnnotationException]
[Semantical Error] The annotation "@Doctrine\ORM\Mapping" in class Ampisoft\Bundle\etrackBundle\Entity\Users does not exist, or could not be auto-loaded.

My entity class is as follows:

namespace Ampisoft\Bundle\etrackBundle\Entity;


 use Doctrine\ORM\Mapping as ORM;

 /**
 * @ORM/Entity
 * @ORM/Table(name="users")
 */
class Users
{
/**
 * @ORM/Column(type="integer")
 * @ORM/ID
 * @ORM/GeneratedValue(strategy="AUTO")
 */
protected $id;

/**
 * @ORM\Column(type="string", length=25, unique=true)
 */
protected $username;

/**
 * @ORM\Column(type="string", length=64)
 */
protected $password;


/**
 * @ORM\Column(name="is_active", type="boolean")
 */
private $isActive;

/**
 * @ORM\Column(type="string", length=60, unique=true)
 */
protected $email;

/**
 * @ORM\Column(type="datetime")
 */
protected $lastLogged;
}

Ive looked around on SO and found solutions that match a similar issue but relating to properties, and also one relating to zend but nothing relating to the actual class decleration in symfony2.

Ive installed and updated all vendor packages using composer.

would anyone be able to please point me in the right direction?

Im new to symfony. Many thanks

like image 726
DevDonkey Avatar asked Nov 07 '14 14:11

DevDonkey


1 Answers

You will get this error if you use forward slashes (/) instead of backslashes (\) within the annotation name. That is to say, the error will occur if you do this:

/**
 * @ORM/Entity
 */

Instead of the correct:

/**
 * @ORM\Entity
 */
like image 181
William Lahti Avatar answered Nov 20 '22 12:11

William Lahti