title: Sonata admin bundle, how to use entity repository classes
body: <ol>
  <li><p>Using this code in PropertyAdmin extends Admin :</p>
  
  <pre><code>public function createQuery($context = 'list')
  {   
  $user = $this-&gt;getConfigurationPool()-&gt;getContainer()-&gt;get('security.context')-&gt;getToken()-&gt;getUser();
  $query = $this-&gt;getModelManager()-&gt;createQuery($this-&gt;getClass(), 'o');
  $query-&gt;where('o.Creator=:creator')-&gt;setParameter("creator", $user);
  return $query;
  }
  </code></pre></li>
  </ol>
  
  <p>I was able to limit "list" results to those who "belong" to logged admin ie. only Properties (that is an entity) created by logged admin.</p>
  
  <p>The problem:
  By manually changing the URL (id value like 1, 2...), I can edit Property that belongs to other user. For edit action, above query is not called at all. How to change that behavior?</p>
  
  <p>2.Instead of putting query in controllers, can I fetch it from PropertyRepository class? That would keep logic in models for which I could write unit tests.</p>
  
  <p>3.I am trying: 
  ProductAdmin extends AdminHelper {....}
  AdminHelper extends Admin { ....  }</p>
  
  <p>But it fails saying "Cannot import resource "D:_development\rent2\app/config." from "D:_development\rent2\app/config\routing.yml".</p>
  
  <p>AdminHelper is abstract class but Sonata still reads it. Any solution?</p>