title: How to get a Respository from an Entity?
body: <p>I have an Entity called <code>Game</code> with a related Repository called <code>GameRepository</code>:</p>
  
  <pre><code>/**
   * @ORM\Entity(repositoryClass="...\GameRepository")
   * @ORM\HasLifecycleCallbacks()
   */
  class Game {
      /**
       * @ORM\prePersist
       */
      public function setSlugValue() {
          $this-&gt;slug = $repo-&gt;createUniqueSlugForGame();
      }
  }
  </code></pre>
  
  <p>In the prePersist method, I need to ensure that the Game's slug field is unique, which requires a database query. To do the query, I need access to the <code>EntityManager</code>. I can get the EntityManager from inside GameRepository. So: <strong>how do I get the GameRespository from a Game?</strong></p>