Guest User

Untitled

a guest
May 20th, 2012
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.44 KB | None | 0 0
  1. <?php
  2.  
  3. use \Doctrine\ORM\NoResultException;
  4.  
  5. class EmailValidator extends AgaviValidator
  6. {  
  7.     protected function validate()
  8.     {  
  9.         $aEmail = $this->getData($this->getArgument());
  10.  
  11.         try {
  12.            
  13.             $oEmail = $this->getContext()->getModel('Manager', 'Contact')->findEmail($aEmail['address']);
  14.            
  15.         } catch(NoResultException $oEx) {
  16.  
  17.             $oEmail = new \Entities\Email($aEmail);
  18.         }
  19.        
  20.         $this->export($oEmail);
  21.         return true;
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment