Jet\DataModel_IDController
The base abstract class Controller ID from which all ID controllers must inherit.
Overview of methods
Method | Meaning of |
---|---|
public __construct( DataModel_Definition_Model $data_model_definition, array $options ) |
When creating an instance of a new controller, it is not assumed that it is linked to a specific instance of an entity to begin with. Therefore, a generic instance is created that is linked to the entity definition. |
public setOptions( array $options ) : void |
Sets the controller parameters from the entity definition. |
public assocDataModelInstance( DataModel $data_model ) : void |
Connects the ID controller to a specific entity instance. Thus, an empty/generic ID controller becomes a carrier of a specific identification of a specific record. |
public assocDataModelInstanceProperty( string $name, mixed& $property ) : void |
Links the ID controller to a specific property of a specific entity instance. Thus, an empty/generic ID controller becomes a carrier of a specific identification of a specific record. |
public getDataModelClassName( ) : string |
Returns the name of the entity class to which the controller instance belongs. |
public getDataModelDefinition( ) : DataModel_Definition_Model_Main| DataModel_Definition_Model_Related |
Returns the definition of the entity to which the controller instance belongs. |
public getQuery( ) : DataModel_Query |
Generates a query (WHERE part) to work with a specific record (retrieve, delete, edit). |
public getValue( string $property_name ) : mixed |
Returns the identification element - that is, the value of the property that is used to identify the record. |
public setValue( string $property_name, mixed $value ) : void |
Sets the identification element - that is, the value of the property that is used to identify the record. |
public getPropertyNames( ) : array |
Returns the names of the entity properties that serve as record ID elements. |
public generate( ) : void |
Forced ID generation. For example, it is possible to generate a text identifier for a record before the record is saved. This applies only to those ID controllers that generate the identifier themselves. It doesn't apply to autoincrement id, for example, or passive controller - these controllers don't generate anything by default. But the method is relevant for the UniqueString ID controller and similar. |
public beforeSave( ) : void |
This method is called internally by the DataModel before saving the record and it is up to the logical controller to do what is necessary to do at that moment. Thus, for example, the UniqueString controller generates a random string (if it hasn't done it before). |
public afterSave( mixed $backend_save_result ) : void |
This method is called internally by the DataModel after saving the record to the database and it is again up to the controller how to handle what the database returned after saving the record. Relevant for AutoIncrement controller and similar. Irrelevant for other controllers. |
public __toString( ) : string |
A controller instance bound to a specific record of a specific entity instance can be converted to a string. If the record identification consists of more than one property, then the values within the string are separated by the ':' character. |
public toString( ) : string |
A controller instance bound to a specific record of a specific entity instance can be converted to a string. If the record identification consists of more than one property, then the values within the string are separated by the ':' character. |