92
Phalcon Models
Model consists of information or data of the application. It manipulates the data by managing the rules. It is found under directory PhalconMvcModel which remain same for all basic application.
It provides following services:
- Database Independence
- CRUD functionality
- Advanced finding capabilities
- Ability to relate models
Below are the lists of some features which can be Enable/Disable specific feature:
Option | Description | Default |
---|---|---|
astCache | Enables/Disables callbacks, hooks and event notifications from all the models. | null |
cacheLevel | 3 | |
castOnHydrate | false | |
columnRenaming | Enables/Disables the column renaming. | true |
disableAssignSetters | Allow disabling setters in your model. | false |
enableImplicitJoins | true | |
enableLiterals | true | |
events | Enables/Disables callbacks, hooks and event notifications from all the models. | true |
exceptionOnFailedSave | Enables/Disables throwing an exception when there is a failed save(). | false |
lateStateBinding | Enables/Disables late state binding of the PhalconMvcModel::cloneResultMap()method. | false |
notNullValidations | The ORM automatically validate the not null columns present in the mapped table | true |
parserCache | null | |
phqlLiterals | Enables/Disables literals in the PHQL parser | true |
uniqueCacheId | 3 | |
updateSnapshotOnSave | Enables/Disables updating snapshots on save(). | true |
Creating Models
Model is a class that extends PhalconMvcModel. In creating models, initialize() method is used which is called only once during the request.
But if we want to perform initialize task for every instance we uses onConstruct() method.
Next TopicPhalcon Model Behaviors