From 9177ab3b098936ced8f0d37e926bae3e78755fb8 Mon Sep 17 00:00:00 2001 From: Haralan Dobrev Date: Wed, 27 Aug 2014 04:52:33 +0300 Subject: [PATCH] Dispath validation event hooks --- src/ValidateTrait.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ValidateTrait.php b/src/ValidateTrait.php index 1645723..95eee9a 100644 --- a/src/ValidateTrait.php +++ b/src/ValidateTrait.php @@ -2,6 +2,8 @@ namespace Harp\Validate; +use Harp\Harp\Repo\Event; + /** * Add this trait to your object to make them "validateable" * @@ -40,7 +42,9 @@ public function getErrors() */ public function validate() { + self::getRepo()->dispatchBeforeEvent($this, Event::VALIDATE); $this->errors = $this->getValidationAsserts()->validate($this); + self::getRepo()->dispatchAfterEvent($this, Event::VALIDATE); return $this->isEmptyErrors(); }