title: How to use constant in the ON condition in Yii2 hasMany relation
body: <p>I try to create a polymorphic association, what is common in Rails but unfortunately not in Yii2. As part of the implementation I need to define the relation:</p>
  
  <pre class="lang-php prettyprint-override"><code>public function getImages()
  {
     return $this-&gt;hasMany(RecipeImage::className(), 
         ['imageable_id' =&gt; 'id', 'imageable_type' =&gt; 'Person']);
  }
  </code></pre>
  
  <p>But this doesn't work, because 'Person' is treated as an attribute of the current model, but it is a constant (class name for the polymorphic association).</p>
  
  <p>If I try to use 'andWhere' it adds the condition of course in a WHERE clause instead of the ON clause, causing that only records with existing image returned.</p>
  
  <pre class="lang-php prettyprint-override"><code>public function getImages()
  {
     return $this-&gt;hasMany(RecipeImage::className(), ['imageable_id' =&gt; 'id'])-&gt;
         andWhere(['imageable_type' =&gt; 'Ingredient']);
  }
  </code></pre>
  
  <p>How can I define the relation? There is no andOn method.</p>