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

PHQL or Raw SQL

Guys what to use PHQL or Raw SQL? (your recommendation)



98.9k

PHQL and Raw SQL are the same in about 90%. If you need to use a custom syntax or custom SQL extensions you must use Raw SQL, in the remaining cases, PHQL will play better with your OO application, providing more security, automatic escaping of reserved words, dynamic renaming of columns, transparent migration to other database systems, extensibility and ease of maintenance. In fact, the entire framework is designed to work with PHQL.