title: How to generate Doctrine entities From Database and Use PSR-4 Autoloading?
body: <p>Using Doctrine <code>2.5</code> with PSR-4 autoloading and converting an already designed database schema to entity classes (annotations). The problem is getting the exported files in the correct directory structure.</p>
  
  <p><em>composer.json</em></p>
  
  <pre><code>{
      "autoload": {
          "psr-4": {
              "Application\\": "src/"
          }
      },
      "require": {
          "doctrine/orm": "^2.5"
      }
  }
  </code></pre>
  
  <p><em>orm:convert-mapping</em></p>
  
  <pre><code>vendor/bin/doctrine orm:convert-mapping \
      --namespace='Application\Entity\' \
      --force \
      --from-database  \
      annotation \
      src/
  </code></pre>
  
  <p>Running this command will add an <code>Application</code> directory in <code>src/</code>.
  The generated class file has the correct namespace but in the wrong directory for PSR-4 standard. </p>
  
  <pre><code>&lt;?php
  
  namespace Application\Entity;
  
  use Doctrine\ORM\Mapping as ORM;
  
  /**
   * User
   *
   * @ORM\Table(name="user")
   * @ORM\Entity
   */
  class User
  {
      /**
       * @var integer
       *
       * @ORM\Column(name="id", type="integer", nullable=false)
       * @ORM\Id
       * @ORM\GeneratedValue(strategy="IDENTITY")
       */
      private $id;
  
  
  }
  </code></pre>
  
  <p>Is there a way to solve this without a secondary command?</p>