Exemple #1
0
 /**
  * This function performs the validation work for complex object models.
  *
  * In addition to checking the current object, all related objects will
  * also be validated.  If all pass then <code>true</code> is returned; otherwise
  * an aggreagated array of ValidationFailed objects will be returned.
  *
  * @param      array $columns Array of column names to validate.
  * @return     mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
  */
 protected function doValidate($columns = null)
 {
     if (!$this->alreadyInValidation) {
         $this->alreadyInValidation = true;
         $retval = null;
         $failureMap = array();
         // We call the validate method on the following object(s) if they
         // were passed to this object by their coresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aPassenger !== null) {
             if (!$this->aPassenger->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aPassenger->getValidationFailures());
             }
         }
         if ($this->aPerson !== null) {
             if (!$this->aPerson->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aPerson->getValidationFailures());
             }
         }
         if (($retval = CompanionPeer::doValidate($this, $columns)) !== true) {
             $failureMap = array_merge($failureMap, $retval);
         }
         if ($this->collMissionCompanions !== null) {
             foreach ($this->collMissionCompanions as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         $this->alreadyInValidation = false;
     }
     return !empty($failureMap) ? $failureMap : true;
 }
Exemple #2
0
 /**
  * This function performs the validation work for complex object models.
  *
  * In addition to checking the current object, all related objects will
  * also be validated.  If all pass then <code>true</code> is returned; otherwise
  * an aggreagated array of ValidationFailed objects will be returned.
  *
  * @param      array $columns Array of column names to validate.
  * @return     mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
  */
 protected function doValidate($columns = null)
 {
     if (!$this->alreadyInValidation) {
         $this->alreadyInValidation = true;
         $retval = null;
         $failureMap = array();
         // We call the validate method on the following object(s) if they
         // were passed to this object by their coresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aMissionRequest !== null) {
             if (!$this->aMissionRequest->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aMissionRequest->getValidationFailures());
             }
         }
         if ($this->aItinerary !== null) {
             if (!$this->aItinerary->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aItinerary->getValidationFailures());
             }
         }
         if ($this->aMissionType !== null) {
             if (!$this->aMissionType->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aMissionType->getValidationFailures());
             }
         }
         if ($this->aPassenger !== null) {
             if (!$this->aPassenger->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aPassenger->getValidationFailures());
             }
         }
         if ($this->aRequesterRelatedByRequesterId !== null) {
             if (!$this->aRequesterRelatedByRequesterId->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aRequesterRelatedByRequesterId->getValidationFailures());
             }
         }
         if ($this->aAgencyRelatedByAgencyId !== null) {
             if (!$this->aAgencyRelatedByAgencyId->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aAgencyRelatedByAgencyId->getValidationFailures());
             }
         }
         if ($this->aRequesterRelatedByOtherRequesterId !== null) {
             if (!$this->aRequesterRelatedByOtherRequesterId->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aRequesterRelatedByOtherRequesterId->getValidationFailures());
             }
         }
         if ($this->aAgencyRelatedByOtherAgencyId !== null) {
             if (!$this->aAgencyRelatedByOtherAgencyId->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aAgencyRelatedByOtherAgencyId->getValidationFailures());
             }
         }
         if ($this->aCamp !== null) {
             if (!$this->aCamp->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aCamp->getValidationFailures());
             }
         }
         if ($this->aCoordinator !== null) {
             if (!$this->aCoordinator->validate($columns)) {
                 $failureMap = array_merge($failureMap, $this->aCoordinator->getValidationFailures());
             }
         }
         if (($retval = MissionPeer::doValidate($this, $columns)) !== true) {
             $failureMap = array_merge($failureMap, $retval);
         }
         if ($this->collMissionCompanions !== null) {
             foreach ($this->collMissionCompanions as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         if ($this->collMissionLegs !== null) {
             foreach ($this->collMissionLegs as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         if ($this->collMissionPhotos !== null) {
             foreach ($this->collMissionPhotos as $referrerFK) {
                 if (!$referrerFK->validate($columns)) {
                     $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                 }
             }
         }
         $this->alreadyInValidation = false;
     }
     return !empty($failureMap) ? $failureMap : true;
 }