PHQL (Phalcon Query Language) is one of the most innovative and powerful parts of Phalcon and by using it we gain some features and security protections over the standard direct PDO access. Normally, if these features were added to an ORM (Object Relation Model) then it would have higher performance penalties but with Phalcon it is essentially unnoticeable because the parser uses highly optimized native libraries written in the C language. We gain a lot of powerful features and if any of these features turn out to be undesirable for us then we can disable each of them on a global or individual query level.
Let's review some of the main benefits over using PDO and standard SQL that we have covered in other recipes. For starters, PHQL understands our model storage details by referencing DI services and by the actual PHP model class implementation where we establish relationships and other settings. This allows us to think in a generality that hides much of the...