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

How to use custom/3rd party ORM with PhalconPHP

Hi

I wish to use a 3rd party ORM (Doctrine) with PhalconPHP.

Is that possible? How would I do that?

Yours sincerely, Arvind.

Easy, you use 3rd party ORM instead of the one shipped with Phalcon :) Components in Phalcon framework are loosely coupled and don't heavily depend on each other. You need just to configure the ORM of your choice and use it in normal way. Which one are you after?

Hi Thank you for your reply. I was thinking of using Doctrine.

Sincerely, Arvind.

OK, then general recommendations would be to use Packagist (https://packagist.org/) to keep Doctrine versions management and register your classes with its autoloader instead of Phalcon's. Then, in your application bootstrap or initialization file just configure Doctrine as normal and use it. No drama.

How can I implement models inheritance with phalcon's ORM ? I mean in doctrine I can tell the inheritance strategy and it maps my models to the database. Is that possible with phalcon's ORM ? Thanks !