I'm using this code:
class MysqlAdapter extends \Phalcon\Db\Adapter\Pdo\Mysql
{
static public function inOperator($array)
{
$randomstring = substr("abcdefghijklmnopqrstuvwxyz", mt_rand(0,25), 1);
$placeholders = array();
$bindparams = array();
foreach ($array as $key => $value)
{
//Numeric placeholder is not allowed, prepend a random char before the number
if (is_int($key) || ctype_digit($key))
$key = sprintf("%s%d", $randomstring, $key);
$placeholders[] = ":$key:";
$bindparams[ $key ] = $value;
}
return array(
'placeholders' => implode(",", $placeholders),
'bindparams' => $bindparams,
);
}
}
//Then, in the controller or model:
$inparams = MysqlAdapter::inOperator($user_ids);
$activity = UserActivityNo::find(array(
"conditions" => sprintf("user_id IN (%s)", $inparams['placeholders']),
"bind" => $inparams['bindparams'],
);