title: Many Medias for One exercise in Sonata Media Bundle
body: <p>I'm facing this weird problem with Sonata media bundle.</p>
  
  <p>Basically, I have an exercise that can have many pictures.</p>
  
  <p>My mapping of Exercice (it's French language) is : </p>
  
  <pre><code> /**
    * @ORM\OneToMany(targetEntity="Application\Sonata\MediaBundle\Entity\Media", mappedBy="exercice")
    */
      private $medias;
  </code></pre>
  
  <p>Then I go to Application/Sonara/MediaBundle/Entity/Media.php and add a field $exercice:</p>
  
  <pre><code>namespace Application\Sonata\MediaBundle\Entity;
  
  use Sonata\MediaBundle\Entity\BaseMedia as BaseMedia;
  use Doctrine\ORM\Mapping as ORM;
  
  
  class Media extends BaseMedia
  {
      /**
       * @var integer $id
       */
      protected $id;
  
      /**
       * @var
       * @ORM\ManyToOne(targetEntity="Acme\AcmeBundle\Entity\Exercice", inversedBy="medias")
       */
      private $exercice;
  </code></pre>
  
  <p>Weird things that happen : </p>
  
  <ol>
  <li>When I run : <code>php app/console doctrine:generate:entities Application\Sonata\MediaBundle:Media</code>
  I don't see any setter or getter for Exercice inside Media entity. 
  
  <ol start="2">
  <li>I get this error in profiler : </li>
  </ol></li>
  </ol>
  
  <blockquote>
    <p>The association Acme\AcmeBundle\Entity\Exercice#medias refers to
    the owning side field
    Application\Sonata\MediaBundle\Entity\Media#exercice which does not
    exist.</p>
  </blockquote>
  
  <p>The relevant part of config :</p>
  
  <p>orm:
      auto_generate_proxy_classes: "%kernel.debug%"
      auto_mapping: true
      mappings:
            ApplicationSonataMediaBundle: ~
            SonataMediaBundle: ~</p>
  
  <p>What am I doing wrong ? </p>
  
  <p>Thanks</p>