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 phalcon query builder without ORM

Hello everyone I'm trying to use phalcon without ORM. I want to separate business logic and data access with DataMapper pattern and I can't find how I can build queries without raw query strings, using original phalcon queryBuilder.

Is there any chance to do it?

I'm using Doctrine ORM in Phalcon with that goal in mind.

My models are simple and have no logic. I don't want to link them with db tables. Looks like I need to use PHQL in that case.

My models are simple and have no logic. I don't want to link them with db tables. Looks like I need to use PHQL in that case.

That's what entities are in Doctrine. Doctrine ORM uses the DataMapper pattern.

From the doctrine docs

What is Doctrine?

Doctrine 2 is an object-relational mapper (ORM) for PHP 5.4+ that provides transparent persistence for PHP objects. It uses the Data Mapper pattern at the heart, aiming for a complete separation of your domain/business logic from the persistence in a relational database management system.

Oh, now I see. Thanks a lot, I will try it.