title: Catchable Fatal Error: Argument 1 passed to (...) must be an instance of (...) integer given
body: <p>I'm making fixtures and when I try to load them I have an error. I need an instance of a Movie object but what I give, and I don't know why, is an integer. For this reason it says me that I have the following error: </p>
  
  <pre><code> [Symfony\Component\Debug\Exception\ContextErrorException]
   Catchable Fatal Error: Argument 1 passed to Filmboot\MovieBundle\Document\A
   ward::setMovie() must be an instance of Filmboot\MovieBundle\Document\Movie
   , integer given, called in C:\Programming\xampp\htdocs\filmboot.web\src\Fil
   mboot\MovieBundle\DataFixtures\MongoDB\Awards.php on line 143 and defined i
   n C:\Programming\xampp\htdocs\filmboot.web\src\Filmboot\MovieBundle\Documen
   t\Award.php line 107
  </code></pre>
  
  <p>This is my Fixture class:</p>
  
  <pre><code>namespace Filmboot\MovieBundle\DataFixtures\MongoDB;
  
  use Doctrine\Common\DataFixtures\AbstractFixture;
  use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
  use Doctrine\Common\Persistence\ObjectManager;
  
  use Filmboot\MovieBundle\Document\Award;
  
  class Awards extends AbstractFixture implements OrderedFixtureInterface {
      public function load(ObjectManager $manager) {
          $awards = array(
              array(
                  "name"     =&gt; "Sitges",
                  "year"     =&gt; "1992",
                  "category" =&gt; "Best director"
          );
  
          foreach ($awards as $award) {
              $document = new Award();
              $document-&gt;setName    ($award["name"]);
              $document-&gt;setYear    ($award["year"]);
              $document-&gt;setCategory($award["category"]);
  
              $manager-&gt;persist($document);
              $this-&gt;addReference("award-" .$i, $award);
  
          }
  
          $manager-&gt;flush();
      }
      public function getOrder() {
          return 1;
      }
  }
  </code></pre>
  
  <p>And this is the document class:</p>
  
  <pre><code>namespace Filmboot\MovieBundle\Document;
  
  use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
  use Doctrine\Common\Collections\ArrayCollection;
  use Filmboot\MovieBundle\Util;
  
  /**
   * @ODM\Document(db="filmbootdb", collection="awards")
   * @ODM\Document(repositoryClass="Filmboot\MovieBundle\Document\AwardRepository")
   */
  class Award {
      /**
       * @ODM\Id
       */
      private $id;
  
      /**
       * @ODM\String
       */
      private $name;
  
      /**
       * @ODM\Int
       */
      private $year;
  
      /**
       * @ODM\String
       */
      private $category;
  
  
      /**
       * @ODM\ReferenceOne(targetDocument="Movie", mappedBy="awards", cascade={"persist"})
       */
      private $movie;
  
  
  
      public function getId()        {
          return $this-&gt;id;
      }
  
      public function setName($name) {
          return $this-&gt;name = $name;
      }
  
      public function getName()      {
          return $this-&gt;name;
      }
  
      public function setYear($year) {
          return $this-&gt;year = $year;
      }
  
      public function getYear()      {
          return $this-&gt;year;
      }
  
      public function setCategory($category) {
          return $this-&gt;category = $category;
      }
  
      public function getCategory()  {
          return $this-&gt;category;
      }    
  
      public function setMovie(\Filmboot\MovieBundle\Document\Movie $movie)   {
          $movie-&gt;setAward($this);
          return $this-&gt;movie = $movie;
      }
  
  }
  </code></pre>