function executeEditLocacion() { $c = new Criteria(); $c->add(RelEstablecimientoLocacionPeer::FK_ESTABLECIMIENTO_ID, $this->getRequestParameter('id')); // estas son las locaciones del establecimiento actual $establecimientoLocaciones = RelEstablecimientoLocacionPeer::doSelectJoinLocacion($c); $optionsEstablecimientoLocaciones = array(); foreach ($establecimientoLocaciones as $establecimientoLocacion) { $optionsEstablecimientoLocaciones[$establecimientoLocacion->getFkLocacionId()] = $establecimientoLocacion->getLocacion()->getNombre(); } // estos son todas las locaciones existentes $todasLasLocaciones = array(); $locaciones = LocacionPeer::doSelect(new Criteria()); foreach ($locaciones as $locacion) { $todasLasLocaciones[$locacion->getId()] = $locacion->getNombre(); } // estos son las locaciones existentes menos las del establecimiento $this->optionsLocaciones = array_diff_key($todasLasLocaciones, $optionsEstablecimientoLocaciones); $this->establecimiento = EstablecimientoPeer::retrieveByPK($this->getRequestParameter('id')); $this->optionsEstablecimientoLocaciones = $optionsEstablecimientoLocaciones; }
public function getRelEstablecimientoLocacionsJoinLocacion($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) { if ($criteria === null) { $criteria = new Criteria(EstablecimientoPeer::DATABASE_NAME); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collRelEstablecimientoLocacions === null) { if ($this->isNew()) { $this->collRelEstablecimientoLocacions = array(); } else { $criteria->add(RelEstablecimientoLocacionPeer::FK_ESTABLECIMIENTO_ID, $this->id); $this->collRelEstablecimientoLocacions = RelEstablecimientoLocacionPeer::doSelectJoinLocacion($criteria, $con, $join_behavior); } } else { $criteria->add(RelEstablecimientoLocacionPeer::FK_ESTABLECIMIENTO_ID, $this->id); if (!isset($this->lastRelEstablecimientoLocacionCriteria) || !$this->lastRelEstablecimientoLocacionCriteria->equals($criteria)) { $this->collRelEstablecimientoLocacions = RelEstablecimientoLocacionPeer::doSelectJoinLocacion($criteria, $con, $join_behavior); } } $this->lastRelEstablecimientoLocacionCriteria = $criteria; return $this->collRelEstablecimientoLocacions; }