I'm creating an "IN" query like this:
$bind = array();
$bindTypes = array();
$i = 0;
$p = array();
foreach($values as $v){
$p[] = '?' . $i;
$bind[$i] = $v;
$bindTypes[$i] = \Phalcon\Db\Column::BIND_PARAM_INT;
$i++;
}
Now -- if I try to execute this using find():
$list = implode(',', $p);
ModelName::find(" MyValue in ($list) ", $bind, $bindTypes);
I get a PDOException: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':0, :1, :2) ORDER BY
However, it works just fine if I use the models manager:
$list = implode(',', $p);
$results = $this->modelsManager->executeQuery("SELECT * FROM ModelName WHERE MyValue in ($list) ",
$bind, $bindTypes);
As far as I can tell from my logs, the exact same sql is being generated behind the scenes for each method. Anyone have any ideas what's going on?