【发布时间】:2014-11-07 14:15:44
【问题描述】:
在执行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;
}
我查看了 SO 并找到了与类似问题相匹配但与属性相关的解决方案,以及与 zend 相关但与 symfony2 中的实际类声明无关的解决方案。
我已经使用 composer 安装和更新了所有供应商软件包。
谁能指点我正确的方向?
我是 symfony 的新手。非常感谢
【问题讨论】:
-
嗯,我认为您需要将正斜杠替换为反斜杠:
@ORM/Entity替换为@ORM\Entity。不知道这是否会有所帮助,但尝试一下也无妨……;)
标签: php symfony doctrine-orm doctrine