Phalcon has a powerful query builder that can generate queries without writing PHQL or SQL. This is accomplished by creating a Phalcon\Mvc\Model\Query\Builder
object and then chaining a series of methods together to generate a Phalcon\Mvc\Model\Query
. This technique also has an advantage of having IDE support through the Developer Tools integration.
This recipe uses the chapter_04
database that we set up in the chapter introduction and the Phalcon Developer Tools which we will use to set up a project skeleton.
Follow these steps to complete this recipe:
We need to have an application skeleton for experimentation. If you already have such an application, you can skip this step. Create a project skeleton using the simple template:
phalcon project query_builder simple
Now point the web browser at the root directory of the project. There should be a page with
Congratulations! ....
. If we see theVolt directory...