DevDonkey
DevDonkey

Reputation: 4880

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

Upvotes: 8

Views: 8712

Answers (1)

William Lahti
William Lahti

Reputation: 1208

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
 */

Upvotes: 25

Related Questions