Models
The models are used to work with data (usually from a database) and to gather, validate and save the data. They're generally stored in phork/sites/[sitetype]/models/, and included with AppLoader::includeModel().
Each model contains an iterator object that stores a set of CoreRecord objects (or extensions thereof). They can also contain zero or more CoreModelHelper objects to assist with things like validation and loading related data (also known as relations).
Phork comes with 3 pre-built core model classes.
- The CoreModel class is an abstract class that most models should extend. It sets up the iterator object, includes the record class, and contains all the function to set up the helpers.
- The CoreDatabaseModel class extends CoreModel and is used to load, add, edit, and delete records in the database.
- The CoreDatabaseScaffoldModel class extends CoreDatabaseModel and builds a model based on the database table definitions.