title: Symfony2 Relationship returns null, should return object
body: <p>I have run into a problem that defies all my attempts to unproblem it. Its probably simple, I have just totally exhausted myself on this one :)</p>
  
  <p>Basically I want to give the user the ability to add modules (facebook id, a bio, text inputs) and assets (image logo, pdf, et al) to a page object.</p>
  
  <p>I have set up a onetomany relationship for Module and Asset to Page. </p>
  
  <p>Module works as expected, however Asset will not work at all: when PageController calls getAsset() from its entity, it is null. There is no error until I try to iterate over the Assets.</p>
  
  <p>Also, in PageController there are the following namespace declarations:</p>
  
  <pre><code>use Linkme\SiteBundle\Entity\Module;
  use Linkme\SiteBundle\Entity\Asset;
  </code></pre>
  
  <p>If I remove the Module declaration I get an error, but if I remove the Asset line, nothing changes. Therefore I believe the relationship is not created.</p>
  
  <p>If I run</p>
  
  <pre><code>app/console doctrine:schema:create --dump-sql
  </code></pre>
  
  <p>then amongst others I get the following line:</p>
  
  <pre><code>ALTER TABLE Asset ADD CONSTRAINT FK_C36E75589D3B65E3 FOREIGN KEY (pageId) REFERENCES Page(id);
  </code></pre>
  
  <p>which makes me think the schema is correct. It as least understands Asset is related to Page</p>
  
  <p>Im starting to feel I have a typo or I am totally missing something equally as obvious - any assistance on troubleshooting or other suggestions would be much appreciated!</p>
  
  <pre><code>app/console --version
  Symfony version 2.0.1 - app/dev/debug
  </code></pre>
  
  <p>Page.php</p>
  
  <pre><code>/*
   * @ORM\OneToMany(targetEntity="Asset", mappedBy="pageId", cascade={"persist", "remove"})
   * @ORM\OrderBy({"type" = "ASC"})
   * @ORM\OrderBy({"id" = "ASC"})
   * 
   * @var ArrayCollection $assets
   */
  protected $assets;
  
  /**
   * @ORM\OneToMany(targetEntity="Module", mappedBy="pageId", cascade={"persist", "remove"})
   * @ORM\OrderBy({"type" = "ASC"})
   * @ORM\OrderBy({"id" = "ASC"})
   *
   * @var ArrayCollection $modules
   */
  protected $modules;
  
  /**
   * Set assets
   * @param Asset $assets
   */
  public function setAssets(Asset $assets = null)
  {
      $this-&gt;assets = $assets;
  }
  
  /**
   * Get assets
   *
   * @return Asset
   */
  public function getAssets()
  {
      echo '&lt;br /&gt;Asset is '.gettype($this-&gt;assets); //   outut:  Asset is NULL
      return $this-&gt;assets;
  }
  
  /**
   * Set modules
   * @param Module $modules
   */
  public function setModules(Module $modules = null)
  {
      $this-&gt;modules = $modules;
  }
  
  /**
   * Get modules
   * @return Module
   */
  public function getModules()
  {
      echo '&lt;br /&gt;Module is '.gettype($this-&gt;assets); //   output:  Module is object
      return $this-&gt;modules;
  }
  </code></pre>
  
  <p>Asset.php</p>
  
  <pre><code>/**
   * @var integer $pageId
   *
   * @ORM\ManyToOne(targetEntity="Page", inversedBy="assets")
   * @ORM\JoinColumn(name="pageId", referencedColumnName="id")
   */
  protected $pageId;
  </code></pre>
  
  <p>Module.php</p>
  
  <pre><code>/**
   * @var integer $pageId
   *
   * @ORM\ManyToOne(targetEntity="Page", inversedBy="modules")
   * @ORM\JoinColumn(name="pageId", referencedColumnName="id")
   */
  protected $pageId;
  </code></pre>
  
  <p>PageController.php</p>
  
  <pre><code>use Linkme\SiteBundle\Entity\Module;
  use Linkme\SiteBundle\Entity\Asset;
  
  /**
   * Add modules  and assets to a page
   *
   * @Route("/{id}/wizardmodule", name="page_wizardmodule")
   * @Template()
   */
  public function wizardmoduleAction($id)
  {
      $em = $this-&gt;getDoctrine()-&gt;getEntityManager();
      $page = $em-&gt;getRepository('LinkmeSiteBundle:Page')-&gt;find($id);
      $modules = $page-&gt;getModules();
      $assets = $page-&gt;getAssets();        
  </code></pre>
  
  <p>depmod</p>
  
  <pre><code>[symfony]
      git=http://github.com/symfony/symfony.git
      version=v2.0.1
  
  [twig]
      git=http://github.com/fabpot/Twig.git
      version=v1.1.2
  
  [monolog]
      git=http://github.com/Seldaek/monolog.git
      version=1.0.1
  
  [doctrine-common]
      git=http://github.com/doctrine/common.git
      version=2.1.1
  
  [doctrine-dbal]
      git=http://github.com/doctrine/dbal.git
      version=2.1.1
  
  [doctrine]
      git=http://github.com/doctrine/doctrine2.git
      version=2.1.1
  
  [swiftmailer]
      git=http://github.com/swiftmailer/swiftmailer.git
      version=v4.1.1
  
  [assetic]
      git=http://github.com/kriswallsmith/assetic.git
      version=v1.0.1
  
  [twig-extensions]
      git=http://github.com/fabpot/Twig-extensions.git
  
  [metadata]
      git=http://github.com/schmittjoh/metadata.git
      version=1.0.0
  
  [SensioFrameworkExtraBundle]
      git=http://github.com/sensio/SensioFrameworkExtraBundle.git
      target=/bundles/Sensio/Bundle/FrameworkExtraBundle
      version=v2.0.1
  
  [JMSSecurityExtraBundle]
      git=http://github.com/schmittjoh/JMSSecurityExtraBundle.git
      target=/bundles/JMS/SecurityExtraBundle
      version=v2.0.1
  
  [SensioDistributionBundle]
      git=http://github.com/sensio/SensioDistributionBundle.git
      target=/bundles/Sensio/Bundle/DistributionBundle
      version=v2.0.1
  
  [SensioGeneratorBundle]
      git=http://github.com/sensio/SensioGeneratorBundle.git
      target=/bundles/Sensio/Bundle/GeneratorBundle
      version=v2.0.1
  
  [AsseticBundle]
      git=http://github.com/symfony/AsseticBundle.git
      target=/bundles/Symfony/Bundle/AsseticBundle
      version=v1.0.0
  </code></pre>