title: Doctrine 2 Many To Many follower relationship not working
body: <p>I have followed the example here <a href="http://docs.doctrine-project.org/en/latest/reference/association-mapping.html#many-to-many-self-referencing" rel="nofollow">doctrine 2 documentation</a> and made the entity</p>
  
  <pre><code>    &lt;?php
  namespace Account\Entity;
  
  use Doctrine\ORM\Mapping as ORM;
  use Doctrine\Common\Collections\ArrayCollection;
  use Zend\Filter\Null;
  
  /**
   * @ORM\Entity
   * @ORM\Table(name="accounts")
   */
  class Account
  {
  
      /**
       * @ORM\Id
       * @ORM\GeneratedValue(strategy="AUTO")
       * @ORM\Column(type="integer")
       * @ORM\Column(length=11)
       */
      private $id;
  
      // ...... 
  
      /**
       * @ORM\ManyToMany(targetEntity="Account\Entity\Account", mappedBy="following")
       */
      private $followers;
  
      /**
       * @ORM\ManyToMany(targetEntity="Account\Entity\Account", inversedBy="followers")
       * @ORM\JoinTable(name="followers",
       *      joinColumns={@ORM\JoinColumn(name="account_id", referencedColumnName="id")},
       *      inverseJoinColumns={@ORM\JoinColumn(name="follower_id", referencedColumnName="id")}
       *      )
       */
      private $following;
  
      public function __construct(){
          $this-&gt;followers = new ArrayCollection();
          $this-&gt;following = new ArrayCollection();
      }
  
  
      /**
       * @param mixed $followers
       */
      public function setFollowers($followers)
      {
          $this-&gt;followers[] = $followers;
      }
  
      /**
       * @return mixed
       */
      public function getFollowers()
      {
          return $this-&gt;followers;
      }
  
      public function addFollowers($followers){
          foreach($followers as $follower)
              $this-&gt;followers-&gt;add($follower);
      }
  
      public function removeFollowers($followers){
          $this-&gt;followers-&gt;removeElement($followers);
      }
  
      /**
       * @param mixed $following
       */
      public function setFollowing($following)
      {
          $this-&gt;following[] = $following;
      }
  
      /**
       * @return mixed
       */
      public function getFollowing()
      {
          return $this-&gt;following;
      }
  
      public function addFollowing($followers){
          foreach($followers as $follower)
              $this-&gt;following-&gt;add($follower);
      }
  
      public function removeFollowing($followers){
          $this-&gt;following-&gt;removeElement($followers);
      }
  
  
      /**
       * @param mixed $id
       */
      public function setId($id)
      {
          $this-&gt;id = $id;
      }
  
      /**
       * @return mixed
       */
      public function getId()
      {
          return $this-&gt;id;
      }
  
  }
  </code></pre>
  
  <p>So I have 2 accounts (ids 1 and 2) and made it so that 1 follows (is friend to) 2.
  The column is something like </p>
  
  <pre><code>user_id follower_id
     2         1
  </code></pre>
  
  <p>By using the following code, I'm not getting any results as I should</p>
  
  <pre><code>$user = $this-&gt;entityManager()-&gt;getRepository('Account/Entity/Account')-&gt;find(1);
  $followers = $user-&gt;getFollowers();
  var_dump($followers);
  </code></pre>
  
  <p>It returns something like:</p>
  
  <pre><code>object(Doctrine\ORM\PersistentCollection)#357 (9) { ["snapshot":"Doctrine\ORM\PersistentCollection":private]=&gt; array(0) { } ["owner":"Doctrine\ORM\PersistentCollection":private]=&gt; NULL ["association":"Doctrine\ORM\PersistentCollection":private]=&gt; NULL ["em":"Doctrine\ORM\PersistentCollection":private]=&gt; NULL ["backRefFieldName":"Doctrine\ORM\PersistentCollection":private]=&gt; NULL ["typeClass":"Doctrine\ORM\PersistentCollection":private]=&gt; NULL ["isDirty":"Doctrine\ORM\PersistentCollection":private]=&gt; bool(false) ["initialized":"Doctrine\ORM\PersistentCollection":private]=&gt; bool(false) ["coll":"Doctrine\ORM\PersistentCollection":private]=&gt; object(Doctrine\Common\Collections\ArrayCollection)#358 (1) { ["_elements":"Doctrine\Common\Collections\ArrayCollection":private]=&gt; array(0) { } } }
  </code></pre>
  
  <p>The same happens if I use getFollowing and all the combinations I've tried. Am I missing something? I mean it's pretty much like the documentation code, please help me out!</p>
  
  <p>I'm using Zend Framework 2, if that's of any help.</p>