title: Zend framework recurring dependency
body: <p>In Zend Framework 2 we use the factories to initiate classes. For the factories we make use off the <code>FactoryInterface</code>, which gives you the ability to use the ServiceManager.</p>
  
  <p>Our problems only is with recurring dependency. We have te following</p>
  
  <p>We have the <code>PlaceRepository</code> and <code>PlaceEntity</code>.</p>
  
  <p>The <code>PlaceRepostory</code> is dependend of the <code>PlaceEntity</code> so it knows which entity it needs to return. However the <code>PlaceEntity</code> also needs the <code>PlaceRepostory</code> so it can get a parent place. (like get the country of city x (where both city and country are a place)).</p>
  
  <p>This ends in an forever going dependency.</p>
  
  <p>Now we could inject the service locator in the entity but you loose the ability for easy testing and you can't see of which class it is depended on.</p>
  
  <p>So is there an other option for this or beter option to this problem, so you can still have the dependency but it is not recurring like an inity loop?</p>