Source API for the «PorteAssociations» class
Add "one-to-one", "one-to-many" and "many-to-many" associations.
Public static methods
- register
-
Register the plugin with a Porte instance.
- _modelPropertyBefore
-
Enrich a property model with associations.
Listen to the "model_property_before" event. -
- return
- mixed
- Boolean true if property is an association
- $models
- PorteModels
- $type
- string
- $property
- string
- _modelPropertyBefore_belongsTo
-
Enrich a property model if a "belongs_to" keywork is defined.
-
- return
- null
- $models
- PorteModels
- $type
- string
- $property
- string
- _modelPropertyBefore_HasMany
-
Enrich a property model if a "has_many" keywork is defined.
-
- return
- null
- $models
- PorteModels
- $type
- string
- $property
- string
- _tableUpdateAfter
-
Create the join table in many-to-many associations Listen to the "table_update_after" event.
-
- return
- null
- $table
- PorteTable
- $existingField
- array
- _recordSaveBefore
-
Update record associations before the record is saved.
Listen to the "record_save_before" event. -
- return
- null
- $record
- PorteRecord
- $circular
- array
- _recordSaveAfter
-
Update record associations after the record is saved.
Listen to the "record_save_after" event.
It loops through each associations, and then through each values in the associations. Those values may be int primary keys or instances of PorteRecord. -
- return
- null
- $record
- PorteRecord
- $circular
- array
- _recordDeleteBefore
-
Update record associations before the record is deleted.
Listen to the "record_delete_before" event. -
- return
- null
- $record
- PorteRecord
- makeRecord
-
Create a new PorteRecord instance.
-
- return
- $record
- PorteRecord
- $config
- array
- $type
- string
- $arg
- mixed
- toArray
-
This method is not yet documented.