In this recipe, we will learn how to create relationships between two or more Phalcon\Mvc\Model
classes. This will allow us to use the third normal database form without needing to repeatedly specify primary keys and foreign keys for basic queries.
This recipe uses the chapter_04
database that we set up in the chapter introduction and 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 model_relations 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 can't be written
error message then permissions of the directoryapp/cache
need to be changed to allow the web server to write...