O'Reilly logo

Learning Phalcon PHP by Calin Rada

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Models

Now that we have the user architecture, before we continue with the rest of the database, let's create the models and a simple CLI task to register a new user.

If you have already installed the Phalcon Developer Tools, you can use them to generate models, or you can manually create them. You can also find them in the source code for this chapter.

Tip

Using the model generator will not create relations between tables. You have to manually create them.

All our models will extend the Base models created in the previous chapter. Next, I will show you a few lines of code containing the important parts of the models, excluding the getters, setters, and protected variables.

The User model

The User model will be located under the App\Core\Models namespace ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required