Guest User

Untitled

a guest
Apr 23rd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. public function existsInvalidRecord($validator,$values)
  2. {
  3. $errors = array();
  4. foreach($values as $k => $v)
  5. {
  6. if($k === $this->getCSRFFieldName())
  7. {
  8. continue;
  9. }
  10. if(!$v)
  11. {
  12. continue;
  13. }
  14. $hasInvalidRecord = Doctrine::getTable('anyTable')->existsDuplicateEntry($v);
  15. if($hasInvalidRecord)
  16. {
  17. $error = new sfValidatorError($validator,'anyMessage');
  18. $errors[$k] = $error;
  19. }
  20. }
  21. if($errors)
  22. {
  23. throw new sfValidatorErrorSchema($validator, $errors);
  24. }
  25. return $values;
  26. }
Add Comment
Please, Sign In to add comment