Hi, I've got serious problem in binding with Phalcon PDO and I'm shocked that noone accually called it a problem yet (or I can't find any topic about it). The problem is inconsistence in binding values. Consider those:
// Will return user with id = 1
User::findFirst([
'conditions' => 'id = :id:',
'bind' => ['id' => 1]
]);
// Will produce error "Unknown opcode 58"
User::findFirst([
'conditions' => 'id = :id',
'bind' => ['id' => 1]
]);
but when using raw query I have to do it opposite way:
// $this->db is an Phalcon\Db\Adapter\Pdo\Postgresql object
// Will return user with id = 1
$this->db->query("SELECT * FROM user WHERE id = :id", ['id' => 1])->fetchAll());
// Will produce syntax error at or near ":" LINE 1: SELECT * FROM user WHERE id = $1:
$this->db->query("SELECT * FROM user WHERE id = :id:", ['id' => 1])->fetchAll());
I should just know when to use single colon and then double or there is a story behind this strange logic?