Javatpoint Logo
Javatpoint Logo

Phalcon Models

Model consists of information or data of the application. It manipulates the data by managing the rules. It is found under directory Phalcon\Mvc\Model 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 Phalcon\Mvc\Model::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 Phalcon\Mvc\Model. 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.







Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA