Yeah Antonio, right! but i dont want to build the whole query with the query builder but have to add a particular clause (like WHERE) to an existing query.
See, i have created a class ModelQueries where i have defined all my sql queries in an array & i use it like this to get the query:
ModelQueries::getQuery($modelName, $actionId);
So in this case i have to add the IN condition to the returned query:
$q = ModelQueries::getQuery('Service', 'serviceNames);
$q = conn()->createCommand($q);
$q->where(array('IN','id',array(40,2,24)));
echo $q->getText();
BUT its returning the query without the where clause.
This is the structure of the array:
static $q = array(
'Service' => array(
'showRunningTasks' => array(
'sql' => 'SELECT p.id,s.id as SID, p.name, p.code, s.name as SName, p.firm_id, p.estimated_cost,p.iscompleted
FROM service s, project p where s.id=1 AND s.id=p.service_id',),
'serviceNames' => array(
'sql'=>'select name from service ',),
),
'Client' =>array(
'viewJSON'=>array(
'sql'=>'select *,
(SELECT name from client_categories where id=c.category_id) AS category,
(SELECT name from client_grades where id=c.grade_id) AS grade,
),
(SELECT name from client_groups where id=c.group_id) AS group
from clients c WHERE c.id=:id LIMIT 1',
),
);