title: Get entityManager inside an Entity
body: <p>I'd like to use, something like:</p>
  
  <pre><code>$em = $this-&gt;getEntityManager();
  </code></pre>
  
  <p>Inside a Entity.</p>
  
  <p><strong>I understand I should do this as a service</strong> but for some testing purposes, I want to access it from an Entity.</p>
  
  <p>Is it possible to achieve that?</p>
  
  <p>I've tried to:</p>
  
  <pre><code>$em = $this-&gt;getEntityManager();
  $profile_avatar = $em-&gt;getRepository('bundle:Perfils')-&gt;findOneByUser($this-getId());
  </code></pre>
  
  <p>But isn't working.</p>
  
  <blockquote>
    <p><b>Fatal error</b>:  Call to undefined method
    Proxies\webBundleEntityUserProxy::getEntityManager() in
    <b>/opt/lampp/htdocs/web/src/Pct/bundle/Entity/User.php</b> on line
    <b>449</b><br></p>
  </blockquote>
  
  <p>Why am I trying to do it this way?</p>
  
  <p>I've 3 kinds of users: Facebook, Twitter and MyOwnWebsite users. Each of them have differents avatar which links facebook's profile, twitter's or otherwise, if its myownwebsite user, I retrieve the avatar from a URL in a database. For now, I don't want to create a service, because I'm just trying to make it working, to test it, not to create a final deployment. So this is why I'm trying to call Entity manager from an Entity. I don't want, by now, to modify configuration files, just this entity.</p>