Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Core\Validator;
- use DoctrineModule\Validator\UniqueObject;
- /**
- * Class that validates if objects exist in a given repository with a given list of matched fields only once.
- *
- * @license MIT
- * @link http://www.doctrine-project.org/
- * @author Oskar Bley <oskar@programming-php.net>
- */
- class MyUniqueObject extends UniqueObject
- {
- protected function error($messageKey, $value = null)
- {
- if(is_array($value)){
- $myKey = $this->getOption('myKey') ? $this->getOption('myKey') : 'servico';
- return parent::error($messageKey, $value[$myKey]);
- }
- return parent::error($messageKey, $value);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement