Phalcon PhP - how to execute query inside a controller with parameters
<p>I would like to know how can I execute a query, inside a phalcon controller, using parameters. </p>

<p>My SQL Query:</p>

<pre><code>SELECT a.*, getApplicationData(a.id) as json_data 
FROM application a 
INNER JOIN application_data d on d.application_id = a.id 
WHERE a.form_id=1 
AND d.firstname LIKE '%:searchQuery:%' ;
</code></pre>

<p>Here is how I'm trying to execute (I found it in Phalcon's doc, but the example was not inside a controller).</p>

<pre><code>$applications = $this-&gt;db-&gt;query(
    $sqlQuery, 
    array('searchQuery'=&gt;$searchQuery)
)-&gt;fetchAll();
</code></pre>

<p>I know that since you have the ORM I shouldn't be querying the DB like this, but for the feature I'm working on it has to be like this, this query is dymanic.</p>

<p>My question is how to pass the parameter for the <code>:searchQuery:</code> in the query.</p>

<p>Thanks in advance for any help.</p>