Skip to content

Commit

Permalink
Added BUILD_VALIDATOR_EVENT constant.
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Pustułka committed May 30, 2017
1 parent ac02317 commit 3959c01
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/ORM/Table.php
Expand Up @@ -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.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Validation/ValidatorAwareTrait.php
Expand Up @@ -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) {
Expand Down

0 comments on commit 3959c01

Please sign in to comment.