We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

[bug] PHQL Update Query Always Return True

        $phql = "UPDATE Category SET title='xxx' WHERE id=999";

        $result = $this->modelsManager->executeQuery($phql);

        var_dump($result->success()); // true

The row where id=999 is not existed, but update result is always true.



32.2k
Accepted
answer

hi @jacky I don't know if is it a bug because the query is "well formed", I think what you're needing is use \Phalcon\Di::getDefault()->getShared('db')->getReadConnection()->affectedRows() example

Good luck

thank you very much

hi @jacky I don't know if is it a bug because the query is "well formed", I think what you're needing is use \Phalcon\Di::getDefault()->getShared('db')->getReadConnection()->affectedRows() example

Good luck