Back to top

This is an old revision of the document!


Models

All models in Rack applications extend from the <php>Model</php> class, defined in include/models/Model.class.php. This class provides a basic implementation for CRUD (create, read, update, and delete) functionality for a single database table. It utalizes the PDO prepared statements to construct queries to help preventing SQL injections.

Initialization

A <php>Model</php> object should never be manually created, as Rack provide a function <php>get_model($name)</php> in include/init.php that creates an instance of a <php>Model</php> object for you when need it. The following snippet demonstrates its use:

<PHP> $model = get_model('Registration'); $registrations = $model→get(); </PHP>


documentation/rack/reference/models.1527297251.txt.gz · Last modified: 2022/04/03 16:00 (external edit)