/** * 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 corresponding set // method. This object relates to these object(s) by a // foreign key reference. if ($this->aLeasingUnitType !== null) { if ($this->aLeasingUnitType->isModified() || $this->aLeasingUnitType->isNew()) { $affectedRows += $this->aLeasingUnitType->save($con); } $this->setLeasingUnitType($this->aLeasingUnitType); } if ($this->aLeasingLocation !== null) { if ($this->aLeasingLocation->isModified() || $this->aLeasingLocation->isNew()) { $affectedRows += $this->aLeasingLocation->save($con); } $this->setLeasingLocation($this->aLeasingLocation); } if ($this->aLeasingLeaseType !== null) { if ($this->aLeasingLeaseType->isModified() || $this->aLeasingLeaseType->isNew()) { $affectedRows += $this->aLeasingLeaseType->save($con); } $this->setLeasingLeaseType($this->aLeasingLeaseType); } if ($this->aLeasingProjects !== null) { if ($this->aLeasingProjects->isModified() || $this->aLeasingProjects->isNew()) { $affectedRows += $this->aLeasingProjects->save($con); } $this->setLeasingProjects($this->aLeasingProjects); } if ($this->aLeasingUnitDressUp !== null) { if ($this->aLeasingUnitDressUp->isModified() || $this->aLeasingUnitDressUp->isNew()) { $affectedRows += $this->aLeasingUnitDressUp->save($con); } $this->setLeasingUnitDressUp($this->aLeasingUnitDressUp); } if ($this->aLeasingUnitNumberBedrooms !== null) { if ($this->aLeasingUnitNumberBedrooms->isModified() || $this->aLeasingUnitNumberBedrooms->isNew()) { $affectedRows += $this->aLeasingUnitNumberBedrooms->save($con); } $this->setLeasingUnitNumberBedrooms($this->aLeasingUnitNumberBedrooms); } if ($this->isNew() || $this->isModified()) { // persist changes if ($this->isNew()) { $this->doInsert($con); } else { $this->doUpdate($con); } $affectedRows += 1; $this->resetModified(); } if ($this->leasingAppointmentssScheduledForDeletion !== null) { if (!$this->leasingAppointmentssScheduledForDeletion->isEmpty()) { foreach ($this->leasingAppointmentssScheduledForDeletion as $leasingAppointments) { // need to save related object because we set the relation to null $leasingAppointments->save($con); } $this->leasingAppointmentssScheduledForDeletion = null; } } if ($this->collLeasingAppointmentss !== null) { foreach ($this->collLeasingAppointmentss as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->leasingBookingssScheduledForDeletion !== null) { if (!$this->leasingBookingssScheduledForDeletion->isEmpty()) { foreach ($this->leasingBookingssScheduledForDeletion as $leasingBookings) { // need to save related object because we set the relation to null $leasingBookings->save($con); } $this->leasingBookingssScheduledForDeletion = null; } } if ($this->collLeasingBookingss !== null) { foreach ($this->collLeasingBookingss as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->leasingPriceRangesScheduledForDeletion !== null) { if (!$this->leasingPriceRangesScheduledForDeletion->isEmpty()) { foreach ($this->leasingPriceRangesScheduledForDeletion as $leasingPriceRange) { // need to save related object because we set the relation to null $leasingPriceRange->save($con); } $this->leasingPriceRangesScheduledForDeletion = null; } } if ($this->collLeasingPriceRanges !== null) { foreach ($this->collLeasingPriceRanges as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->leasingTenantssScheduledForDeletion !== null) { if (!$this->leasingTenantssScheduledForDeletion->isEmpty()) { foreach ($this->leasingTenantssScheduledForDeletion as $leasingTenants) { // need to save related object because we set the relation to null $leasingTenants->save($con); } $this->leasingTenantssScheduledForDeletion = null; } } if ($this->collLeasingTenantss !== null) { foreach ($this->collLeasingTenantss as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->leasingUnitCalendarsScheduledForDeletion !== null) { if (!$this->leasingUnitCalendarsScheduledForDeletion->isEmpty()) { foreach ($this->leasingUnitCalendarsScheduledForDeletion as $leasingUnitCalendar) { // need to save related object because we set the relation to null $leasingUnitCalendar->save($con); } $this->leasingUnitCalendarsScheduledForDeletion = null; } } if ($this->collLeasingUnitCalendars !== null) { foreach ($this->collLeasingUnitCalendars as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->leasingUnitFeaturessScheduledForDeletion !== null) { if (!$this->leasingUnitFeaturessScheduledForDeletion->isEmpty()) { foreach ($this->leasingUnitFeaturessScheduledForDeletion as $leasingUnitFeatures) { // need to save related object because we set the relation to null $leasingUnitFeatures->save($con); } $this->leasingUnitFeaturessScheduledForDeletion = null; } } if ($this->collLeasingUnitFeaturess !== null) { foreach ($this->collLeasingUnitFeaturess as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } $this->alreadyInSave = false; } return $affectedRows; }