From 752b4dfec1c82c8b6c093260fba7f5652825b33f Mon Sep 17 00:00:00 2001 From: Björn Geiger Date: Wed, 14 Sep 2011 17:15:50 +0200 Subject: EventTitle Unique --- library/Poolctrl/Validator/TitleUnique.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 library/Poolctrl/Validator/TitleUnique.php (limited to 'library') diff --git a/library/Poolctrl/Validator/TitleUnique.php b/library/Poolctrl/Validator/TitleUnique.php new file mode 100755 index 0000000..e935736 --- /dev/null +++ b/library/Poolctrl/Validator/TitleUnique.php @@ -0,0 +1,25 @@ + "Title is already assigned", + ); + + public function isValid($value) + { + $this->_setValue($value); + $eventMapper = new Application_Model_EventMapper(); + $sameEvent = $eventMapper->findBy(array("title" => $value)); + + if (count($sameEvent) > 0) { + $this->_error(self::NOT_UNIQUE); + return false; + } else { + return true; + } + } +} \ No newline at end of file -- cgit v1.2.3-55-g7522