M Markero
M Markero

Reputation: 199

Symfony 2 - The annotation in property does not exist, or could not be auto-loaded.

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

Answers (2)

m0c
m0c

Reputation: 2191

I think this is Case Sensitive, try:

@ORM/Id

Upvotes: 3

user2359967
user2359967

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

Related Questions