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

Uncaught exception 'Phalcon\Mvc\Model\Exception' in model.zep

Hi, I have an application in Phalcon but I'm receiving the exception:

Fatal error: Uncaught exception 'Phalcon\Mvc\Model\Exception' with message 'A dependency injector container is required to obtain the services related to the ORM' in phalcon/mvc/model.zep on line 213 Phalcon\Mvc\Model\Exception: A dependency injector container is required to obtain the services related to the ORM in phalcon/mvc/model.zep on line 213

And I don't have idea what is the problem, but one thing that I found out debugging is the message stop displaying when I comment my Session initialization:

$di->set('session', function() { $session = new \Phalcon\Session\Adapter\Files( array( 'uniqueId' => 'my-id' ) ); $session->start(); return $session; }, true);

What is the problem?

What will happen if you get session from di or remove a true ? Pretty weird. How looks rest of your di(services and definition ?)