title: Yii2 - createUrl() with array of params?
body: <p>According to the <a href="http://www.yiiframework.com/doc-2.0/yii-web-urlmanager.html#createUrl()-detail" rel="noreferrer">Yii2 documentation</a> , I am supposed to be building the URL like following:</p>
  
  <pre><code>$appUrl = Yii::$app-&gt;urlManager-&gt;createUrl([Yii::$app-&gt;controller-&gt;id . '/' . Yii::$app-&gt;controller-&gt;action-&gt;id,'p1' =&gt; 'v1','p2' =&gt; 'v2'] , null);
  </code></pre>
  
  <p>It outputs:</p>
  
  <blockquote>
    <p>/index.php?r=users%2Findex&amp;p1=v1&amp;p2=v2</p>
  </blockquote>
  
  <p>Which is the correct output. Now, what if I have an array of params that I directly want to pass to the <code>createUrl()</code> method? The following code explains my problem:</p>
  
  <pre><code>$arrayParams = ['p1' =&gt; 'v1' , 'p2' =&gt; 'v2'];
  $appUrl = Yii::$app-&gt;urlManager-&gt;createUrl([Yii::$app-&gt;controller-&gt;id . '/' . Yii::$app-&gt;controller-&gt;action-&gt;id,$arrayParams] , null);
  </code></pre>
  
  <p>The output in this case is:</p>
  
  <blockquote>
    <p>/index.php?r=users/index&amp;1[p1]=v1&amp;1[p2]=v2</p>
  </blockquote>
  
  <p>Whereas the output should have been:</p>
  
  <blockquote>
    <p>index.php?r=users/index&amp;p1=v1&amp;p2=v2</p>
  </blockquote>
  
  <p>Please note that <code>$arrayParams</code> is generated by another method and I can't extract all the keys and values and pass them one by one in <code>createUrl()</code>. That would be very costly IMO. How do I achieve this using Yii's api?</p>