getIterator() public method

See also: IteratorAggregate
public getIterator ( )
 /**
  * Get the validation errors
  *
  * @param ConstraintViolationList $errors Validator error list
  *
  * @return View
  */
 protected function getErrorsView(ConstraintViolationList $errors)
 {
     $msgs = array();
     $errorIterator = $errors->getIterator();
     foreach ($errorIterator as $validationError) {
         $msg = $validationError->getMessage();
         $params = $validationError->getMessageParameters();
         $msgs[][] = $this->get('translator')->trans($msg, $params, 'validators');
     }
     $view = View::create($msgs);
     $view->setStatusCode(400);
     return $view;
 }
Exemplo n.º 2
0
 /**
  * Get the validation errors
  *
  * @param ConstraintViolationList $errors Validator error list
  *
  * @return View
  */
 protected function getErrorsView(ConstraintViolationList $errors)
 {
     $msgs = array();
     $errorIterator = $errors->getIterator();
     foreach ($errorIterator as $validationError) {
         $msg = $validationError->getMessage();
         $params = $validationError->getMessageParameters();
         $msgs[$validationError->getPropertyPath()][] = $this->get('translator')->trans($msg, $params, 'validators');
     }
     $view = View::create($msgs);
     $view->setStatusCode(400);
     return $view;
     return $this->render('CentraleLilleGdpBundle:Tasks:tasks.html.twig');
 }