We will now generate, as in Chapter 1, Building Your First FuelPHP Application, the necessary code to handle our objects.
Let's first generate the scaffold of the project model:
php oil generate scaffold/orm project name:string
The command should print the following output:
Creating migration: APPPATH/migrations/001_create_projects.php Creating model: APPPATH/classes/model/project.php Creating controller: APPPATH/classes/controller/project.php Creating view: APPPATH/views/project/index.php Creating view: APPPATH/views/project/view.php Creating view: APPPATH/views/project/create.php Creating view: APPPATH/views/project/edit.php Creating view: APPPATH/views/project/_form.php Creating view: APPPATH/views/template.php
Note that we used scaffold/orm
instead of scaffold/crud
in Chapter 1, Building Your First FuelPHP Application: this way, oil will generate code files that use the ORM package. For instance, we will see later that the generated model will extend Orm\Model
instead of Model_Crud...