コード例 #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 corresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aLeasingUnit !== null) {
             if ($this->aLeasingUnit->isModified() || $this->aLeasingUnit->isNew()) {
                 $affectedRows += $this->aLeasingUnit->save($con);
             }
             $this->setLeasingUnit($this->aLeasingUnit);
         }
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
             } else {
                 $this->doUpdate($con);
             }
             $affectedRows += 1;
             $this->resetModified();
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
コード例 #2
0
 public function savePropertyAction()
 {
     $request = $this->getRequest();
     $uType = LeasingUnitTypePeer::getTypeByName($request->request->get('type'));
     $uLoc = LeasingLocationPeer::getLocationByName($request->request->get('loc'));
     //Lease Type
     $lt = json_decode($request->request->get('lease'));
     if (count($lt > 1)) {
         $leaseType = 'both';
     } else {
         $leaseType = $lt[0];
     }
     $uLease = LeasingLeaseTypePeer::getLeaseTypeByName($leaseType);
     $unit = LeasingUnitPeer::getUnitByPostId($request->request->get('post_id'));
     if (empty($unit)) {
         $unit = new LeasingUnit();
     }
     $unit->setName($request->request->get('name'));
     $unit->setPostId($request->request->get('post_id'));
     $unit->setContent($request->request->get('content'));
     $unit->setAvailability($request->request->get('avail'));
     $unit->setPriceRange($request->request->get('price'));
     $unit->setStatus(C::ACTIVE);
     $unit->setUnitTypeId($uType->getId());
     $unit->setLocationId($uLoc->getId());
     $unit->setLeaseTypeId($uLease->getId());
     $unit->save();
     return new RedirectResponse('http://leasing.dmcihomes.com.local/wp-admin/post.php');
 }
コード例 #3
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 corresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aLeasingBookingLeads !== null) {
             if ($this->aLeasingBookingLeads->isModified() || $this->aLeasingBookingLeads->isNew()) {
                 $affectedRows += $this->aLeasingBookingLeads->save($con);
             }
             $this->setLeasingBookingLeads($this->aLeasingBookingLeads);
         }
         if ($this->aLeasingUnit !== null) {
             if ($this->aLeasingUnit->isModified() || $this->aLeasingUnit->isNew()) {
                 $affectedRows += $this->aLeasingUnit->save($con);
             }
             $this->setLeasingUnit($this->aLeasingUnit);
         }
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
             } else {
                 $this->doUpdate($con);
             }
             $affectedRows += 1;
             $this->resetModified();
         }
         if ($this->leasingBookingAssignmentsScheduledForDeletion !== null) {
             if (!$this->leasingBookingAssignmentsScheduledForDeletion->isEmpty()) {
                 foreach ($this->leasingBookingAssignmentsScheduledForDeletion as $leasingBookingAssignment) {
                     // need to save related object because we set the relation to null
                     $leasingBookingAssignment->save($con);
                 }
                 $this->leasingBookingAssignmentsScheduledForDeletion = null;
             }
         }
         if ($this->collLeasingBookingAssignments !== null) {
             foreach ($this->collLeasingBookingAssignments as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->leasingPaymentTransactionssScheduledForDeletion !== null) {
             if (!$this->leasingPaymentTransactionssScheduledForDeletion->isEmpty()) {
                 foreach ($this->leasingPaymentTransactionssScheduledForDeletion as $leasingPaymentTransactions) {
                     // need to save related object because we set the relation to null
                     $leasingPaymentTransactions->save($con);
                 }
                 $this->leasingPaymentTransactionssScheduledForDeletion = null;
             }
         }
         if ($this->collLeasingPaymentTransactionss !== null) {
             foreach ($this->collLeasingPaymentTransactionss as $referrerFK) {
                 if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }