title: How to generate entities from database view with doctrine and symfony2
body: <p>I am trying to generate entities from database using standard console commands as described in Symfony2 documentation here: <a href="http://symfony.com/doc/current/cookbook/doctrine/reverse_engineering.html" rel="nofollow noreferrer">http://symfony.com/doc/current/cookbook/doctrine/reverse_engineering.html</a>. </p>
  
  <pre><code>php app/console doctrine:mapping:convert --from-database --force yml "src/My/HomeBundle/Resources/config/doctrine/metadata/orm"
  php app/console doctrine:mapping:import MyHomeBundle yml
  php app/console doctrine:generate:entities MyHomeBundle
  </code></pre>
  
  <p>After this, all tables are generated correctly. The problem is that this won't generate entities for database views. When I add yml files myself into src/My/HomeBundle/Resources/config/doctrine/metadata/orm for example:</p>
  
  <pre><code>UserInGroup:
    type: entity
    table: user_in_group_view
    fields:
      id:
        id: true
        type: integer
        unsigned: false
        nullable: false
        generator:
          strategy: IDENTITY
      userId:
        type: integer
        unsigned: false
        nullable: false
        column: user_id
      userGroupId:
        type: integer
        unsigned: false
        nullable: false
        column: user_group_id
    lifecycleCallbacks: {  }
  </code></pre>
  
  <p>I get this exception when running <code>php app/console doctrine:generate:entities MyHomeBundle</code>:</p>
  
  <pre><code>Notice: Undefined index: My\HomeBundle\Entity\UserInGroup in C:\Users\ThisIsMe\Projects\SymfonyTestProject\vendor\doctrine\lib\Doctrine\ORM\Mapping\Driver\AbstractFileDriver.php line 121
  </code></pre>
  
  <p>Similar question was posted here: <a href="https://stackoverflow.com/questions/8377671/how-to-set-up-entity-doctrine-for-database-view-in-symfony-2">How to set up entity (doctrine) for database view in Symfony 2</a></p>
  
  <p>I know I can create Entity class, but I was hoping that I could get this generated so if I change my view, I could just regenerate entity classes. Any suggestions?</p>