pclib  3.0.0
Lightweight PHP framework
Template tags implemented by class Model
  • class
    • model - required for model template
    • table "name" - name of the database table
  • relation - Create relation to another model
    • table "name" Name of the related database table
    • key "column" Column name used to joining tables
    • one | owner | many | many_to_many Relation type: 1:1, N:1, 1:N or M:N (for M:N is used pivot table, you can specify its name with "through" directive)
  • column - Create column validations - you can use common template attributes, such as "required" or "nosave"
  • column - Create calculated column
    • get "methodName" Method in your model class used for geting value (getter)
    • set "methodName" Method in your model class used for setting value (setter)
  • event ondelete - Specify what to do with related models, when model is deleted (only ondelete is supported now) (related models are ignored by default)
    • delete "comma-separated-list-of-relations" On delete, perform cascade delete of these relations
    • cancel_when "comma-separated-list-of-relations" When some relation exists, model is not deleted
  • role "name" - Specify role with access rights to model. You can enable role with $model->setRole($name);
    • rights "read,save,delete" List of allowed rights
    • read "columns or *" which columns role can read
    • write "columns or *" which columns role can write