[英]Symfony 2 - The annotation in property does not exist, or could not be auto-loaded.
I'm doing symfony 2 tutorial - Doctrine and databases. 我正在做symfony 2教程 - Doctrine和数据库。
I created the file Pages.php in Entity/Pages.php 我在Entity / Pages.php中创建了Pages.php文件
<?php
namespace Dproc\MainBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @IgnoreAnnotation("fn")
*
*/
/**
* @ORM\Entity
* @ORM\Table(name="pages")
*/
class Pages
{
/**
* @ORM\ID
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $ID;
/**
* @ORM\Column(type="text")
*/
protected $page_title;
/**
* @ORM\Column(type="text")
*/
protected $page_content;
/**
* @ORM\Column(type="text")
*/
protected $page_category;
}
Now i'm trying to generate setters and getters for this class using this command. 现在我正在尝试使用此命令为此类生成setter和getter。
php app/console doctrine:generate:entities Dproc/MainBundle/Entity/Pages
It tells : 它说 :
[Doctrine\Common\Annotations\AnnotationException]
[Semantical Error] The annotation "@Doctrine\ORM\Mapping\ID" in property Dp
roc\MainBundle\Entity\Pages::$ID does not exist, or could not be auto-loade
d.
What i am doing wrong? 我做错了什么?
Change your $ID with the following code: 使用以下代码更改您的$ ID:
/**
* @var integer
*
* @ORM\Column(type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
我认为这是区分大小写的,请尝试:
@ORM/Id
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.