Book Image

FuelPHP Application Development Blueprints

By : Sebastien Drouyer
Book Image

FuelPHP Application Development Blueprints

By: Sebastien Drouyer

Overview of this book

Table of Contents (13 chapters)
FuelPHP Application Development Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Models, relations, and the ORM


We have now done the preliminary steps: we installed FuelPHP, configured it, generated the scaffold for managing the projects, and created the task model. We didn't connect the two models though, and we haven't yet displayed tasks anywhere. More importantly, we haven't explained how to load objects until now. This is the aim of this section.

Differences between CRUD and ORM

As we explained earlier, we used oil to generate code, but instead of using scaffold/crud as in Chapter 1, Building Your First FuelPHP Application, we used scaffold/orm and model/orm. If you take a look at the files (controllers, views, and models), you will only see minor changes, except for the model files:

  • The $_table_name attribute is no longer declared. It is still used by Orm\Model though, but it takes a default value that depends on the model name, so you can still define it if you want to use a custom table name.

  • The $_properties attribute has been added. This attribute contains all...