Example #1
0
 protected function doSave($con)
 {
     $affectedRows = 0;
     if (!$this->alreadyInSave) {
         $this->alreadyInSave = true;
         if ($this->aResourceVersionRelatedByResourceVersionId !== null) {
             if ($this->aResourceVersionRelatedByResourceVersionId->isModified()) {
                 $affectedRows += $this->aResourceVersionRelatedByResourceVersionId->save($con);
             }
             $this->setResourceVersionRelatedByResourceVersionId($this->aResourceVersionRelatedByResourceVersionId);
         }
         if ($this->isModified()) {
             if ($this->isNew()) {
                 $pk = ResourceVersionPeer::doInsert($this, $con);
                 $affectedRows += 1;
                 $this->setId($pk);
                 $this->setNew(false);
             } else {
                 $affectedRows += ResourceVersionPeer::doUpdate($this, $con);
             }
             $this->resetModified();
         }
         if ($this->collResourceVersionsRelatedByResourceVersionId !== null) {
             foreach ($this->collResourceVersionsRelatedByResourceVersionId as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collResourceAttributeVersions !== null) {
             foreach ($this->collResourceAttributeVersions as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }