Reputation: 199
I'm doing symfony 2 tutorial - Doctrine and databases.
I created the file Pages.php in Entity/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.
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?
Upvotes: 6
Views: 9218
Reputation:
Change your $ID with the following code:
/**
* @var integer
*
* @ORM\Column(type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
Upvotes: 11