/** * 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->aWing !== null) { if ($this->aWing->isModified() || $this->aWing->isNew()) { $affectedRows += $this->aWing->save($con); } $this->setWing($this->aWing); } if ($this->isNew()) { $this->modifiedColumns[] = EmailListPeer::ID; } // If this object has been modified, then save it to the database. if ($this->isModified()) { if ($this->isNew()) { $pk = EmailListPeer::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 += EmailListPeer::doUpdate($this, $con); } $this->resetModified(); // [HL] After being saved an object is no longer 'modified' } if ($this->collEmailListPersons !== null) { foreach ($this->collEmailListPersons as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collEmailListRoles !== null) { foreach ($this->collEmailListRoles as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } $this->alreadyInSave = false; } return $affectedRows; }
/** * 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->aPerson !== null) { if ($this->aPerson->isModified() || $this->aPerson->isNew()) { $affectedRows += $this->aPerson->save($con); } $this->setPerson($this->aPerson); } if ($this->aWing !== null) { if ($this->aWing->isModified() || $this->aWing->isNew()) { $affectedRows += $this->aWing->save($con); } $this->setWing($this->aWing); } if ($this->aMemberClass !== null) { if ($this->aMemberClass->isModified() || $this->aMemberClass->isNew()) { $affectedRows += $this->aMemberClass->save($con); } $this->setMemberClass($this->aMemberClass); } if ($this->aMemberRelatedByMasterMemberId !== null) { if ($this->aMemberRelatedByMasterMemberId->isModified() || $this->aMemberRelatedByMasterMemberId->isNew()) { $affectedRows += $this->aMemberRelatedByMasterMemberId->save($con); } $this->setMemberRelatedByMasterMemberId($this->aMemberRelatedByMasterMemberId); } if ($this->isNew()) { $this->modifiedColumns[] = MemberPeer::ID; } // If this object has been modified, then save it to the database. if ($this->isModified()) { if ($this->isNew()) { $pk = MemberPeer::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 += MemberPeer::doUpdate($this, $con); } $this->resetModified(); // [HL] After being saved an object is no longer 'modified' } if ($this->collApplications !== null) { foreach ($this->collApplications as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collAvailabilitys !== null) { foreach ($this->collAvailabilitys as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collCoordinators !== null) { foreach ($this->collCoordinators as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collMembersRelatedByMasterMemberId !== null) { foreach ($this->collMembersRelatedByMasterMemberId as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collMemberWingJobs !== null) { foreach ($this->collMemberWingJobs as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collMissionLegsRelatedByCopilotId !== null) { foreach ($this->collMissionLegsRelatedByCopilotId as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collMissionLegsRelatedByBackupCopilotId !== null) { foreach ($this->collMissionLegsRelatedByBackupCopilotId as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collPilots !== null) { foreach ($this->collPilots as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collPilotAircrafts !== null) { foreach ($this->collPilotAircrafts as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collPilotDates !== null) { foreach ($this->collPilotDates as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collPilotRequests !== null) { foreach ($this->collPilotRequests as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } $this->alreadyInSave = false; } return $affectedRows; }