Beispiel #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);
 }
Beispiel #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);
 }
Beispiel #3
0
 public function getRelEstablecimientoLocacionsJoinEstablecimiento($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     if ($criteria === null) {
         $criteria = new Criteria(LocacionPeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collRelEstablecimientoLocacions === null) {
         if ($this->isNew()) {
             $this->collRelEstablecimientoLocacions = array();
         } else {
             $criteria->add(RelEstablecimientoLocacionPeer::FK_LOCACION_ID, $this->id);
             $this->collRelEstablecimientoLocacions = RelEstablecimientoLocacionPeer::doSelectJoinEstablecimiento($criteria, $con, $join_behavior);
         }
     } else {
         $criteria->add(RelEstablecimientoLocacionPeer::FK_LOCACION_ID, $this->id);
         if (!isset($this->lastRelEstablecimientoLocacionCriteria) || !$this->lastRelEstablecimientoLocacionCriteria->equals($criteria)) {
             $this->collRelEstablecimientoLocacions = RelEstablecimientoLocacionPeer::doSelectJoinEstablecimiento($criteria, $con, $join_behavior);
         }
     }
     $this->lastRelEstablecimientoLocacionCriteria = $criteria;
     return $this->collRelEstablecimientoLocacions;
 }
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = RelEstablecimientoLocacionPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setFkEstablecimientoId($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setFkLocacionId($arr[$keys[2]]);
     }
 }
Beispiel #5
0
<?php

$aLocacion = array();
$aLocacion[""] = "--Seleccione una LocaciÃn--";
$c = new Criteria();
$c->add(RelEstablecimientoLocacionPeer::FK_ESTABLECIMIENTO_ID, $sf_user->getAttribute('fk_establecimiento_id'));
$locaciones = RelEstablecimientoLocacionPeer::doSelect($c);
foreach ($locaciones as $locacion) {
    $aLocacion[$locacion->getFkLocacionId()] = $locacion->getLocacion()->getNombre();
}
echo select_tag('espacio[fk_locacion_id]', options_for_select($aLocacion, $espacio->getFkLocacionId()));
 public static function retrieveByPKs($pks, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(RelEstablecimientoLocacionPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(RelEstablecimientoLocacionPeer::DATABASE_NAME);
         $criteria->add(RelEstablecimientoLocacionPeer::ID, $pks, Criteria::IN);
         $objs = RelEstablecimientoLocacionPeer::doSelect($criteria, $con);
     }
     return $objs;
 }