首页 > 代码库 > phalcon:model 事件与事件管理器

phalcon:model 事件与事件管理器

事件与事件管理器(Events and Events Manager)¶

Models allow you to implement events that will be thrown when performing an insert/update/delete. They help define business rules for a certain model. The following are the events supported by Phalcon\Mvc\Model and their order of execution:

OperationNameCan stop operation?Explanation
Inserting/UpdatingbeforeValidationYESIs executed before the fields are validated for not nulls/empty strings or foreign keys
InsertingbeforeValidationOnCreateYESIs executed before the fields are validated for not nulls/empty strings or foreign keys when an insertion operation is being made
UpdatingbeforeValidationOnUpdateYESIs executed before the fields are validated for not nulls/empty strings or foreign keys when an updating operation is being made
Inserting/UpdatingonValidationFailsYES (already stopped)Is executed after an integrity validator fails
InsertingafterValidationOnCreateYESIs executed after the fields are validated for not nulls/empty strings or foreign keys when an insertion operation is being made
UpdatingafterValidationOnUpdateYESIs executed after the fields are validated for not nulls/empty strings or foreign keys when an updating operation is being made
Inserting/UpdatingafterValidationYESIs executed after the fields are validated for not nulls/empty strings or foreign keys
Inserting/UpdatingbeforeSaveYESRuns before the required operation over the database system
UpdatingbeforeUpdateYESRuns before the required operation over the database system only when an updating operation is being made
InsertingbeforeCreateYESRuns before the required operation over the database system only when an inserting operation is being made
UpdatingafterUpdateNORuns after the required operation over the database system only when an updating operation is being made
InsertingafterCreateNORuns after the required operation over the database system only when an inserting operation is being made
Inserting/UpdatingafterSaveNORuns after the required operation over the database system

phalcon:model 事件与事件管理器