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

ODM findById is not working with Phalcon 3.0.1 - Windows x86 for PHP 5.6.0 (vc11)

Hi everyone! i use ODM findById in my code and it working good with Phalcon 2.0.13 - Windows x86 for PHP 5.6.0 (vc11) with xampp But when i upgrade phalcon to Phalcon 3.0.1 - Windows x86 for PHP 5.6.0 (vc11) that function not return object Anyone help me how to resolve it ? thanks

Show us logs ?

test:

$id= 1; $doc = \DanhMucKhac::findById($id); //return null

//this return object $doc = \DanhMucKhac::findFirst(array( 'conditions' => array('_id' => $id) ));

i think findById function error in phalcon 3.x

use this :

:findById(new \MongoId($id));