Ejemplo n.º 1
0
 /**
  * Performs the work of inserting or updating the row in the database.
  *
  * If the object is new, it inserts it; otherwise an update is performed.
  * All related objects are also updated in this method.
  *
  * @param      PropelPDO $con
  * @return     int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  * @throws     PropelException
  * @see        save()
  */
 protected function doSave(PropelPDO $con)
 {
     $affectedRows = 0;
     // initialize var to track total num of affected rows
     if (!$this->alreadyInSave) {
         $this->alreadyInSave = true;
         // We call the save 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->aPcTimezone !== null) {
             if ($this->aPcTimezone->isModified() || $this->aPcTimezone->isNew()) {
                 $affectedRows += $this->aPcTimezone->save($con);
             }
             $this->setPcTimezone($this->aPcTimezone);
         }
         if ($this->isNew()) {
             $this->modifiedColumns[] = PcUserPeer::ID;
         }
         // If this object has been modified, then save it to the database.
         if ($this->isModified()) {
             if ($this->isNew()) {
                 $pk = PcUserPeer::doInsert($this, $con);
                 $affectedRows += 1;
                 // we are assuming that there is only 1 row per doInsert() which
                 // should always be true here (even though technically
                 // BasePeer::doInsert() can insert multiple rows).
                 $this->setId($pk);
                 //[IMV] update autoincrement primary key
                 $this->setNew(false);
             } else {
                 $affectedRows += PcUserPeer::doUpdate($this, $con);
             }
             $this->resetModified();
             // [HL] After being saved an object is no longer 'modified'
         }
         if ($this->collPcRemembermeKeys !== null) {
             foreach ($this->collPcRemembermeKeys as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collPcDirtyTasks !== null) {
             foreach ($this->collPcDirtyTasks as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->singlePcFailedLogins !== null) {
             if (!$this->singlePcFailedLogins->isDeleted()) {
                 $affectedRows += $this->singlePcFailedLogins->save($con);
             }
         }
         if ($this->singlePcActivationToken !== null) {
             if (!$this->singlePcActivationToken->isDeleted()) {
                 $affectedRows += $this->singlePcActivationToken->save($con);
             }
         }
         if ($this->singlePcPasswordResetToken !== null) {
             if (!$this->singlePcPasswordResetToken->isDeleted()) {
                 $affectedRows += $this->singlePcPasswordResetToken->save($con);
             }
         }
         if ($this->singlePcPlancakeEmailAddress !== null) {
             if (!$this->singlePcPlancakeEmailAddress->isDeleted()) {
                 $affectedRows += $this->singlePcPlancakeEmailAddress->save($con);
             }
         }
         if ($this->collPcLists !== null) {
             foreach ($this->collPcLists as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collPcUsersListss !== null) {
             foreach ($this->collPcUsersListss as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collPcEmailChangeHistorys !== null) {
             foreach ($this->collPcEmailChangeHistorys as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collPcUsersContextss !== null) {
             foreach ($this->collPcUsersContextss as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->singlePcSupporter !== null) {
             if (!$this->singlePcSupporter->isDeleted()) {
                 $affectedRows += $this->singlePcSupporter->save($con);
             }
         }
         if ($this->collPcBlogPosts !== null) {
             foreach ($this->collPcBlogPosts as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collPcBlogComments !== null) {
             foreach ($this->collPcBlogComments as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collPcApiApps !== null) {
             foreach ($this->collPcApiApps as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collPcApiTokens !== null) {
             foreach ($this->collPcApiTokens as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collPcNotes !== null) {
             foreach ($this->collPcNotes as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collPcSubscriptions !== null) {
             foreach ($this->collPcSubscriptions as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collPcGoogleCalendars !== null) {
             foreach ($this->collPcGoogleCalendars as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->singlePcUserKey !== null) {
             if (!$this->singlePcUserKey->isDeleted()) {
                 $affectedRows += $this->singlePcUserKey->save($con);
             }
         }
         if ($this->collPcContacts !== null) {
             foreach ($this->collPcContacts as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collPcContactTags !== null) {
             foreach ($this->collPcContactTags as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collPcContactsTagss !== null) {
             foreach ($this->collPcContactsTagss as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collPcContactNotes !== null) {
             foreach ($this->collPcContactNotes as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->singlePcHideableHintsSetting !== null) {
             if (!$this->singlePcHideableHintsSetting->isDeleted()) {
                 $affectedRows += $this->singlePcHideableHintsSetting->save($con);
             }
         }
         if ($this->collPcSplitTestUserResults !== null) {
             foreach ($this->collPcSplitTestUserResults as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }