title: Related models with conditions in Phalcon
body: <p>How to setup filtering on related model data using <code>$this-&gt;hasMany()</code> or <code>$this-&gt;hasOne()</code> in model?</p>
  
  <p>For instance:</p>
  
  <p>I have SomeData table which can be referenced to ModalA or ModelB.
  In ModelA and ModelB i have:</p>
  
  <pre><code>$this-&gt;hasMany(array('id', 'SomeData', 'foreign_key');
  </code></pre>
  
  <p>In ModelA I want to get all SomeData where <code>SomeData.foreign_key = id and SomeData.model = "ModelA"</code>.</p>
  
  <p>I can easily get them with:</p>
  
  <pre><code>$this-&gt;getRelated(
      'SomeData',
       array("model = :model:", 'bind' =&gt; array('model' =&gt; 'ModelA')
  );
  </code></pre>
  
  <p>but <code>$modelA-&gt;SomeData</code> gives me SomeData for ModelA and ModelB.</p>
  
  <p>I've tried adding conditions in <code>$this-&gt;hasMany()</code> but without any luck.</p>