/**
  * 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->aLeasingEventPlace !== null) {
             if ($this->aLeasingEventPlace->isModified() || $this->aLeasingEventPlace->isNew()) {
                 $affectedRows += $this->aLeasingEventPlace->save($con);
             }
             $this->setLeasingEventPlace($this->aLeasingEventPlace);
         }
         if ($this->aLeasingEventLeads !== null) {
             if ($this->aLeasingEventLeads->isModified() || $this->aLeasingEventLeads->isNew()) {
                 $affectedRows += $this->aLeasingEventLeads->save($con);
             }
             $this->setLeasingEventLeads($this->aLeasingEventLeads);
         }
         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;
 }
Example #2
0
 public function saveEventAction()
 {
     $request = $this->getRequest();
     $ep = LeasingEventPlacePeer::getEventPlaceByPostId($request->request->get('post_id'));
     if (empty($ep)) {
         $ep = new LeasingEventPlace();
     }
     $ep->setName($request->request->get('name'));
     $ep->setPostId($request->request->get('post_id'));
     $ep->setContent($request->request->get('content'));
     $ep->setShortAddress($request->request->get('short_address'));
     $ep->setFullAddress($request->request->get('full_address'));
     $ep->setContact($request->request->get('contact'));
     $ep->setEmail($request->request->get('email'));
     $ep->save();
     return new RedirectResponse('http://leasing.dmcihomes.com.local/wp-admin/post.php');
 }
 /**
  * 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->aLeasingEventPlace !== null) {
             if ($this->aLeasingEventPlace->isModified() || $this->aLeasingEventPlace->isNew()) {
                 $affectedRows += $this->aLeasingEventPlace->save($con);
             }
             $this->setLeasingEventPlace($this->aLeasingEventPlace);
         }
         if ($this->aLeasingEventLeads !== null) {
             if ($this->aLeasingEventLeads->isModified() || $this->aLeasingEventLeads->isNew()) {
                 $affectedRows += $this->aLeasingEventLeads->save($con);
             }
             $this->setLeasingEventLeads($this->aLeasingEventLeads);
         }
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
             } else {
                 $this->doUpdate($con);
             }
             $affectedRows += 1;
             $this->resetModified();
         }
         if ($this->leasingEventPaymentDetailssScheduledForDeletion !== null) {
             if (!$this->leasingEventPaymentDetailssScheduledForDeletion->isEmpty()) {
                 foreach ($this->leasingEventPaymentDetailssScheduledForDeletion as $leasingEventPaymentDetails) {
                     // need to save related object because we set the relation to null
                     $leasingEventPaymentDetails->save($con);
                 }
                 $this->leasingEventPaymentDetailssScheduledForDeletion = null;
             }
         }
         if ($this->collLeasingEventPaymentDetailss !== null) {
             foreach ($this->collLeasingEventPaymentDetailss 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;
 }