/** * 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; }
protected function doSave($con) { $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; if ($this->aMemberDetail !== null) { if ($this->aMemberDetail->isModified()) { $affectedRows += $this->aMemberDetail->save($con); } $this->setMemberDetail($this->aMemberDetail); } if ($this->aDepartment !== null) { if ($this->aDepartment->isModified()) { $affectedRows += $this->aDepartment->save($con); } $this->setDepartment($this->aDepartment); } if ($this->aStaffType !== null) { if ($this->aStaffType->isModified()) { $affectedRows += $this->aStaffType->save($con); } $this->setStaffType($this->aStaffType); } if ($this->aEmployeeDetail !== null) { if ($this->aEmployeeDetail->isModified()) { $affectedRows += $this->aEmployeeDetail->save($con); } $this->setEmployeeDetail($this->aEmployeeDetail); } if ($this->aStudent !== null) { if ($this->aStudent->isModified()) { $affectedRows += $this->aStudent->save($con); } $this->setStudent($this->aStudent); } if ($this->isModified()) { if ($this->isNew()) { $pk = MemberPeer::doInsert($this, $con); $affectedRows += 1; $this->setId($pk); $this->setNew(false); } else { $affectedRows += MemberPeer::doUpdate($this, $con); } $this->resetModified(); } if ($this->collStudents !== null) { foreach ($this->collStudents as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collVisitors !== null) { foreach ($this->collVisitors as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collMemberPhotos !== null) { foreach ($this->collMemberPhotos as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collColOrders !== null) { foreach ($this->collColOrders as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collColItems !== null) { foreach ($this->collColItems 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->collMemberDetails !== null) { foreach ($this->collMemberDetails as $referrerFK) { if (!$referrerFK->isDeleted()) { $affectedRows += $referrerFK->save($con); } } } if ($this->collVVisitorMembers !== null) { foreach ($this->collVVisitorMembers 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; }