How to print converted SQL query from yii2 query
<p>I want to print query:</p>

<pre><code>$demo = Demo::find()-&gt;all();
</code></pre>

<p>I want to see converted SQL query with parameters:</p>

<pre><code>createCommand()-&gt;getRawSql();
</code></pre>

<p>is showing me an error message: </p>

<blockquote>
  <p>yii2 Call to a member function createCommand() on a non-object</p>
</blockquote>

<p>Please help me to see the actual SQL query.</p>