/**
  * 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.
  */
 public function validate(ValidatorInterface $validator = null)
 {
     if (null === $validator) {
         if (class_exists('Symfony\\Component\\Validator\\Validator\\LegacyValidator')) {
             $validator = new LegacyValidator(new ExecutionContextFactory(new DefaultTranslator()), new ClassMetaDataFactory(new StaticMethodLoader()), new ConstraintValidatorFactory());
         } else {
             $validator = new Validator(new ClassMetadataFactory(new StaticMethodLoader()), new ConstraintValidatorFactory(), new DefaultTranslator());
         }
     }
     $failureMap = new ConstraintViolationList();
     if (!$this->alreadyInValidation) {
         $this->alreadyInValidation = true;
         $retval = null;
         // We call the validate method on the following object(s) if they
         // were passed to this object by their corresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         // If validate() method exists, the validate-behavior is configured for related object
         if (method_exists($this->aInterested, 'validate')) {
             if (!$this->aInterested->validate($validator)) {
                 $failureMap->addAll($this->aInterested->getValidationFailures());
             }
         }
         // If validate() method exists, the validate-behavior is configured for related object
         if (method_exists($this->aTarget_Event, 'validate')) {
             if (!$this->aTarget_Event->validate($validator)) {
                 $failureMap->addAll($this->aTarget_Event->getValidationFailures());
             }
         }
         $retval = $validator->validate($this);
         if (count($retval) > 0) {
             $failureMap->addAll($retval);
         }
         $this->alreadyInValidation = false;
     }
     $this->validationFailures = $failureMap;
     return (bool) (!(count($this->validationFailures) > 0));
 }