Esempio n. 1
0
 protected function doSave($con)
 {
     $affectedRows = 0;
     if (!$this->alreadyInSave) {
         $this->alreadyInSave = true;
         if ($this->aQuestion !== null) {
             if ($this->aQuestion->isModified()) {
                 $affectedRows += $this->aQuestion->save($con);
             }
             $this->setQuestion($this->aQuestion);
         }
         if ($this->aUser !== null) {
             if ($this->aUser->isModified()) {
                 $affectedRows += $this->aUser->save($con);
             }
             $this->setUser($this->aUser);
         }
         if ($this->isModified()) {
             if ($this->isNew()) {
                 $pk = AnswerPeer::doInsert($this, $con);
                 $affectedRows += 1;
                 $this->setId($pk);
                 $this->setNew(false);
             } else {
                 $affectedRows += AnswerPeer::doUpdate($this, $con);
             }
             $this->resetModified();
         }
         if ($this->collRelevancys !== null) {
             foreach ($this->collRelevancys as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collReportAnswers !== null) {
             foreach ($this->collReportAnswers as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }