在执行php app/console doctrine:generate:entities etBundle:Users
时,我得到了以下错误消息:
[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.
我的实体类如下:
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;
}
我在Stack Overflow上查看了相关问题的解决方案,但是这些方案都与属性有关,还有一些与Zend有关,但没有与Symfony2中实际的类声明有关的解决方案。
我使用Composer安装并更新了所有供应商软件包。
请问是否有人能够指点我正确的方向?
我对Symfony很新,请多多指教。
@ORM/Entity
替换为@ORM\Entity
。不知道这是否有助于解决问题,但尝试一下不会有任何损失... ;) - Jovan Perovic