public function validate(Validator $validator = null)
    {
        if (null === $validator) {
            $validator = new Validator(new ClassMetadataFactory(new StaticMethodLoader()), new ConstraintValidatorFactory(), new DefaultTranslator());
        }

        $failureMap = new ConstraintViolationList();

        if (!$this->alreadyInValidation) {
            $this->alreadyInValidation = true;
            $retval = null;


            $retval = $validator->validate($this);
            if (count($retval) > 0) {
                $failureMap->addAll($retval);
            }

            if (null !== $this->collAttributeAttributeTypes) {
                foreach ($this->collAttributeAttributeTypes as $referrerFK) {
                    if (method_exists($referrerFK, 'validate')) {
                        if (!$referrerFK->validate($validator)) {
                            $failureMap->addAll($referrerFK->getValidationFailures());
                        }
                    }
                }
            }
            if (null !== $this->collAttributeTypeI18ns) {
                foreach ($this->collAttributeTypeI18ns as $referrerFK) {
                    if (method_exists($referrerFK, 'validate')) {
                        if (!$referrerFK->validate($validator)) {
                            $failureMap->addAll($referrerFK->getValidationFailures());
                        }
                    }
                }
            }

            $this->alreadyInValidation = false;
        }

        $this->validationFailures = $failureMap;

        return (Boolean) (!(count($this->validationFailures) > 0));

    }
public function validate(Validator $validator = null)
    {
        if (null === $validator) {
            $validator = new Validator(new ClassMetadataFactory(new StaticMethodLoader()), new ConstraintValidatorFactory(), new DefaultTranslator());
        }

        $failureMap = new ConstraintViolationList();

        if (!$this->alreadyInValidation) {
            $this->alreadyInValidation = true;
            $retval = null;


            $retval = $validator->validate($this);
            if (count($retval) > 0) {
                $failureMap->addAll($retval);
            }

            if (null !== $this->collAttributeAttributeTypes) {
                foreach ($this->collAttributeAttributeTypes as $referrerFK) {
                    if (method_exists($referrerFK, 'validate')) {
                        if (!$referrerFK->validate($validator)) {
                            $failureMap->addAll($referrerFK->getValidationFailures());
                        }
                    }
                }
            }
            if (null !== $this->collAttributeTypeI18ns) {
                foreach ($this->collAttributeTypeI18ns as $referrerFK) {
                    if (method_exists($referrerFK, 'validate')) {
                        if (!$referrerFK->validate($validator)) {
                            $failureMap->addAll($referrerFK->getValidationFailures());
                        }
                    }
                }
            }

            $this->alreadyInValidation = false;
        }

        $this->validationFailures = $failureMap;

        return (Boolean) (!(count($this->validationFailures) > 0));

    }
public function validate ( Validator $ validator = null ) { if ( null === $ validator ) { $ validator = new Validator ( new ClassMetadataFactory ( new StaticMethodLoader ( ) ) , new ConstraintValidatorFactory ( ) , new DefaultTranslator ( ) ) ; } $ failureMap = new ConstraintViolationList ( ) ; if ( ! $ this -> alreadyInValidation ) { $ this -> alreadyInValidation = true ; $ retval = null ; $ retval = $ validator -> validate ( $ this ) ; if ( count ( $ retval ) > 0 ) { $ failureMap -> addAll ( $ retval ) ; } if ( null !== $ this -> collAttributeAttributeTypes ) { foreach ( $ this -> collAttributeAttributeTypes as $ referrerFK ) { if ( method_exists ( $ referrerFK , 'validate' ) ) { if ( ! $ referrerFK -> validate ( $ validator ) ) { $ failureMap -> addAll ( $ referrerFK -> getValidationFailures ( ) ) ; } } } } if ( null !== $ this -> collAttributeTypeI18ns ) { foreach ( $ this -> collAttributeTypeI18ns as $ referrerFK ) { if ( method_exists ( $ referrerFK , 'validate' ) ) { if ( ! $ referrerFK -> validate ( $ validator ) ) { $ failureMap -> addAll ( $ referrerFK -> getValidationFailures ( ) ) ; } } } } $ this -> alreadyInValidation = false ; } $ this -> validationFailures = $ failureMap ; return ( Boolean ) ( ! ( count ( $ this -> validationFailures ) > 0 ) ) ; }
Validates the object and all objects related to this table.

@see        getValidationFailures()
@param      object $validator A Validator class instance
@return     boolean Whether all objects pass validation.
Validates the object and all objects related to this table .