Exemplo n.º 1
0
 protected function doSave($con)
 {
     $affectedRows = 0;
     if (!$this->alreadyInSave) {
         $this->alreadyInSave = true;
         if ($this->aCatalog !== null) {
             if ($this->aCatalog->isModified()) {
                 $affectedRows += $this->aCatalog->save($con);
             }
             $this->setCatalog($this->aCatalog);
         }
         if ($this->aColStatus !== null) {
             if ($this->aColStatus->isModified()) {
                 $affectedRows += $this->aColStatus->save($con);
             }
             $this->setColStatus($this->aColStatus);
         }
         if ($this->aColCondition !== null) {
             if ($this->aColCondition->isModified()) {
                 $affectedRows += $this->aColCondition->save($con);
             }
             $this->setColCondition($this->aColCondition);
         }
         if ($this->aMember !== null) {
             if ($this->aMember->isModified()) {
                 $affectedRows += $this->aMember->save($con);
             }
             $this->setMember($this->aMember);
         }
         if ($this->aColLocation !== null) {
             if ($this->aColLocation->isModified()) {
                 $affectedRows += $this->aColLocation->save($con);
             }
             $this->setColLocation($this->aColLocation);
         }
         if ($this->aColSource !== null) {
             if ($this->aColSource->isModified()) {
                 $affectedRows += $this->aColSource->save($con);
             }
             $this->setColSource($this->aColSource);
         }
         if ($this->isModified()) {
             if ($this->isNew()) {
                 $pk = ColItemPeer::doInsert($this, $con);
                 $affectedRows += 1;
                 $this->setId($pk);
                 $this->setNew(false);
             } else {
                 $affectedRows += ColItemPeer::doUpdate($this, $con);
             }
             $this->resetModified();
         }
         if ($this->collColOrders !== null) {
             foreach ($this->collColOrders as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collCirHistorys !== null) {
             foreach ($this->collCirHistorys as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collLatePayments !== null) {
             foreach ($this->collLatePayments as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collVCirHistoryMembers !== null) {
             foreach ($this->collVCirHistoryMembers as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }