Advertisement
Guest User

Untitled

a guest
Jan 26th, 2015
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.93 KB | None | 0 0
  1. <?php
  2.  
  3. namespace Core\Validator;
  4.  
  5. use DoctrineModule\Validator\UniqueObject;
  6.  
  7. /**
  8.  * Class that validates if objects exist in a given repository with a given list of matched fields only once.
  9.  *
  10.  * @license MIT
  11.  * @link    http://www.doctrine-project.org/
  12.  * @author  Oskar Bley <oskar@programming-php.net>
  13.  */
  14. class MyUniqueObject extends UniqueObject
  15. {
  16.    
  17.     /**
  18.      * @param  string $messageKey
  19.      * @param  string $value      OPTIONAL
  20.      * @return void
  21.      */
  22.     protected function error($messageKey, $value = null)
  23.     {
  24.         if ($messageKey === null) {
  25.             $keys = array_keys($this->abstractOptions['messageTemplates']);
  26.             $messageKey = current($keys);
  27.         }
  28.    
  29.         if ($value === null) {
  30.             $value = $this->value;
  31.         }
  32.                
  33.         $this->abstractOptions['messages'][$messageKey] = $this->createMessage($messageKey, $value['servico']);
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement