Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Query builder can't parse where condition

Hi! I have a simple piece of code:

        $email = '[email protected]';
        $qb = $this->modelsManager->createBuilder();
        $qb->addFrom('App\Model\User', 'a');
        $qb->where(' = :email', ['email' => $email]);

Result: Phalcon\Mvc\Model\Exception: Scanner: Unknown opcode 58

When I provide email like below:

$qb->where(' = "[email protected]"');

It seems to work. Is there anything in phalcom ORM what might be useful?

Edit: OK, my fault, I haven't noticed that DOUBLE colon is required like :email: what is really unusual


PHQL syntax requires both left and right colon for paramter placeholders:

        $qb->where(' = :email:', ['email' => $email]);

You can mark the thread as solved now :)