diff --git a/src/ORM/Table.php b/src/ORM/Table.php index d426fa4ff6a..b2887ce8d07 100644 --- a/src/ORM/Table.php +++ b/src/ORM/Table.php @@ -138,6 +138,13 @@ class Table implements RepositoryInterface, EventListenerInterface, EventDispatc */ const VALIDATOR_PROVIDER_NAME = 'table'; + /** + * The name of the event dispatched when a validator has been built. + * + * @var string + */ + const BUILD_VALIDATOR_EVENT = 'Model.buildValidator'; + /** * The rules class name that is used. * diff --git a/src/Validation/ValidatorAwareTrait.php b/src/Validation/ValidatorAwareTrait.php index 9d44c2c94b1..df3c3b688dc 100644 --- a/src/Validation/ValidatorAwareTrait.php +++ b/src/Validation/ValidatorAwareTrait.php @@ -169,7 +169,7 @@ public function createValidator($name) $validator = new $this->_validatorClass; $validator = $this->{'validation' . ucfirst($name)}($validator); if ($this instanceof EventDispatcherInterface) { - $this->dispatchEvent('Model.buildValidator', compact('validator', 'name')); + $this->dispatchEvent(self::BUILD_VALIDATOR_EVENT, compact('validator', 'name')); } if (!$validator instanceof Validator) {