Модели в Phalcon/Model in Phalcon

Друзья, подскажите, почему не работает код:

$user = User::findFirst(['email' => $email, 'active' => '1']);

При любом $email возвращается первая запись в таблице. Если же использовать данный код:

$user = User::findFirst([
                'conditions'    => 'email = :email: AND active="1"',
                'bind'          => [
                    'email'         => $data['email'],
                ],
]);

все работает правильно. Что не так?


Guys, tell me, why this code is not working?

$user = User::FindFirst (['email' => $ email, 'activo' => '1']); 

For any email it returns the first record of the table. If I use this code:

$user = User::findFirst([
                'conditions'    => 'email = :email: AND active="1"',
                'bind'          => [
                    'email'         => $data['email'],
                ],
]);

Everything works properly. What is happening/what is wrong?



85.4k

This syntax:

$user = User::FindFirst (['email' => $ email, 'activo' => '1']);

It isn't supported by the ORM. You can see the supported syntax in the documentation: http://docs.phalconphp.com/es/latest/reference/models.html#finding-records