protected function validate($object)
    {
        $errorList = $this->get('validator')->validate($object);
        if (0 < $errorList->count()) {
            $message = 'Row validation failed.';
            if ($this->getParameter('kernel.debug')) {
                $messages = [];
                /** @var \Symfony\Component\Validator\ConstraintViolationInterface $error */
                foreach ($errorList as $error) {
                    $messages[] = $error->getMessage();
                }
                $message = implode(', ', $messages);
            }
            throw new BadRequestHttpException($message);
        }
    }
protected function validate($object)
    {
        $errorList = $this->get('validator')->validate($object);
        if (0 < $errorList->count()) {
            $message = 'Row validation failed.';
            if ($this->getParameter('kernel.debug')) {
                $messages = [];
                /** @var \Symfony\Component\Validator\ConstraintViolationInterface $error */
                foreach ($errorList as $error) {
                    $messages[] = $error->getMessage();
                }
                $message = implode(', ', $messages);
            }
            throw new BadRequestHttpException($message);
        }
    }
protected function validate ( $ object ) { $ errorList = $ this -> get ( 'validator' ) -> validate ( $ object ) ; if ( 0 < $ errorList -> count ( ) ) { $ message = 'Row validation failed.' ; if ( $ this -> getParameter ( 'kernel.debug' ) ) { $ messages = [ ] ; /** @var \Symfony\Component\Validator\ConstraintViolationInterface $error */ foreach ( $ errorList as $ error ) { $ messages [ ] = $ error -> getMessage ( ) ; } $ message = implode ( ', ' , $ messages ) ; } throw new BadRequestHttpException ( $ message ) ; } }
Validates the object.

@param mixed $object

@throws BadRequestHttpException
Validates the object .