title: stuck on doctrine2 tutorial error "No identifier/primary key specified for Entity "Product". Every Entity must have an identifier/primary key. "
body: <p>After copy-pasting the example as is on the <a href="http://doctrine-orm.readthedocs.org/projects/doctrine-orm/en/latest/tutorials/getting-started.html" rel="nofollow noreferrer">page</a> I am getting this error:</p>
  
  <pre><code>[Doctrine\ORM\Mapping\MappingException]                                                                                
      No identifier/primary key specified for Entity "Product". Every Entity must have an identifier/primary key. 
  </code></pre>
  
  <p>I searched a bit and <a href="https://stackoverflow.com/questions/16357843/stuck-in-tutorial-doctrine2-class-product-is-not-a-valid-entry-or-mapped-super">found out</a> that an entity annotation was missing from the code so I ended up with this code:</p>
  
  <pre><code>&lt;?php
  // bootstrap.php
  
  /**
  * @Entity 
  * @Table(name="Product")
  * property int $id
  * property string $name
  */
  
  use Doctrine\ORM\Tools\Setup;
  use Doctrine\ORM\EntityManager;
  
  require_once "vendor/autoload.php";
  
  // Create a simple "default" Doctrine ORM configuration for Annotations
  $isDevMode = true;
  $config = Setup::createAnnotationMetadataConfiguration(array(__DIR__."/src"), $isDevMode);
  // or if you prefer yaml or XML
  //$config = Setup::createXMLMetadataConfiguration(array(__DIR__."/config/xml"), $isDevMode);
  //$config = Setup::createYAMLMetadataConfiguration(array(__DIR__."/config/yaml"), $isDevMode);
  
  // database configuration parameters
  $conn = array(
      'driver' =&gt; 'pdo_sqlite',
      'path' =&gt; __DIR__ . '/db.sqlite',
  );
  
  // obtaining the entity manager
  $entityManager = EntityManager::create($conn, $config);
  </code></pre>
  
  <p>The product creator is also  taken from the tutorial:
      
  
  <pre><code>// create_product.php
  require_once "bootstrap.php";
  
  
  $newProductName = $argv[1];
  
  $product = new Product();
  $product-&gt;setName($newProductName);
  
  $entityManager-&gt;persist($product);
  $entityManager-&gt;flush();
  
  echo "Created Product with ID " . $product-&gt;getId() . "\n";
  </code></pre>
  
  <p>The Product is defined here:</p>
  
  <pre><code>&lt;?php
  /**
  * @Entity 
  * @Table(name="Product")
  * property int $id
  * property string $name
  */
  
  // src/Product.php
  class Product
  {
      /**
       * @var integer $id
       * @ORM\Column(name="id", type="integer")
       * @ORM\Id
       * @ORM\GeneratedValue(strategy="AUTO")
       */
      protected $id;
      /**
       * @var string
       */
      protected $name;
  
      public function getId()
      {
          return $this-&gt;id;
      }
  
      public function getName()
      {
          return $this-&gt;name;
      }
  
      public function setName($name)
      {
          $this-&gt;name = $name;
      }
  }
  </code></pre>
  
  <p>I also tried the instructions <a href="https://stackoverflow.com/questions/28168364/symfony2-and-doctrine2-no-identifier-primary-key-specified-for-entity-x-ever">here</a> though they did not give me any result.
  I am very new to doctrine so do you have any ideas on what to try next?</p>