Example #1
0
 protected function deleteLocacion($locacion)
 {
     $id = $locacion->getId();
     $locacion->delete();
     $criteria = new Criteria();
     $criteria->add(RelEstablecimientoLocacionPeer::FK_LOCACION_ID, $id);
     $relEstablecimientoLocacion = RelEstablecimientoLocacionPeer::doDelete($criteria);
 }
Example #2
0
 function executeSaveLocacion()
 {
     // borrar todas las locaciones para un establecimientos determinado
     $establecimientoId = $this->getRequestParameter('id');
     $aLocacion = $this->getRequest()->getParameterHolder()->get('establecimientoLocacion');
     $c = new Criteria();
     $c->add(RelEstablecimientoLocacionPeer::FK_ESTABLECIMIENTO_ID, $establecimientoId);
     RelEstablecimientoLocacionPeer::doDelete($c);
     if (count($aLocacion) > 0) {
         // grabar todos los que vienen seleccionados
         // aqui se debe poder grabar haciendo un solo insert
         $c = new Criteria();
         foreach ($aLocacion as $locacionId) {
             $p = new RelEstablecimientoLocacion();
             $p->setFkLocacionId($locacionId);
             $p->setFkEstablecimientoId($establecimientoId);
             $p->save();
             unset($p);
         }
     }
     $this->getUser()->setFlash('notice', 'Se ha grabado correctamente.');
     return $this->redirect('establecimiento/editLocacion?id=' . $establecimientoId);
 }
 public function delete(PropelPDO $con = null)
 {
     if ($this->isDeleted()) {
         throw new PropelException("This object has already been deleted.");
     }
     if ($con === null) {
         $con = Propel::getConnection(RelEstablecimientoLocacionPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     $con->beginTransaction();
     try {
         RelEstablecimientoLocacionPeer::doDelete($this, $con);
         $this->setDeleted(true);
         $con->commit();
     } catch (PropelException $e) {
         $con->rollBack();
         throw $e;
     }
 }