|
|
@@ -53,12 +53,16 @@ use Cake\Event\EventListenerInterface;
|
|
|
* $primary parameter indicates whether or not this is the root query,
|
|
|
* or an associated query.
|
|
|
*
|
|
|
- * - `beforeValidate(Event $event, Entity $entity, ArrayObject $options, Validator $validator)`
|
|
|
- * Fired before an entity is validated. By stopping this event, you can abort
|
|
|
- * the validate + save operations.
|
|
|
+ * - `buildRules(Event $event, RulesChecker $rules)`
|
|
|
+ * Allows listeners to modify the rules checker by adding more rules.
|
|
|
*
|
|
|
- * - `afterValidate(Event $event, Entity $entity, ArrayObject $options, Validator $validator)`
|
|
|
- * Fired after an entity is validated.
|
|
|
+ * - `beforeRules(Event $event, Entity $entity, RulesChecker $rules)`
|
|
|
+ * Fired before an entity is validated using the rules checker. By stopping this event,
|
|
|
+ * you can return the final value of the rules checking operation.
|
|
|
+ *
|
|
|
+ * - `afterRules(Event $event, Entity $entity,RulesChecker $rules, bool $result)`
|
|
|
+ * Fired after the rules have been checked on the entity.By stopping this event,
|
|
|
+ * you can return the final value of the rules checking operation.
|
|
|
*
|
|
|
* - `beforeSave(Event $event, Entity $entity, ArrayObject $options)`
|
|
|
* Fired before each entity is saved. Stopping this event will abort the save
|
|
|
@@ -239,8 +243,9 @@ class Behavior implements EventListenerInterface {
|
|
|
'Model.afterSave' => 'afterSave',
|
|
|
'Model.beforeDelete' => 'beforeDelete',
|
|
|
'Model.afterDelete' => 'afterDelete',
|
|
|
- 'Model.beforeValidate' => 'beforeValidate',
|
|
|
- 'Model.afterValidate' => 'afterValidate',
|
|
|
+ 'Model.buildRules' => 'buildRules',
|
|
|
+ 'Model.beforeRules' => 'beforeRules',
|
|
|
+ 'Model.afterRules' => 'afterRules',
|
|
|
];
|
|
|
$config = $this->config();
|
|
|
$priority = isset($config['priority']) ? $config['priority'] : null;
|