/**
  * Exclude object from result
  *
  * @param     SocioAlquiler $socioAlquiler Object to remove from the list of results
  *
  * @return    SocioAlquilerQuery The current query, for fluid interface
  */
 public function prune($socioAlquiler = null)
 {
     if ($socioAlquiler) {
         $this->addUsingAlias(SocioAlquilerPeer::ID, $socioAlquiler->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
 /**
  * Filter the query by a related SocioAlquiler object
  *
  * @param     SocioAlquiler $socioAlquiler  the related object to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return    AlquilerQuery The current query, for fluid interface
  */
 public function filterBySocioAlquiler($socioAlquiler, $comparison = null)
 {
     if ($socioAlquiler instanceof SocioAlquiler) {
         return $this->addUsingAlias(AlquilerPeer::ID, $socioAlquiler->getAlquilerId(), $comparison);
     } elseif ($socioAlquiler instanceof PropelCollection) {
         return $this->useSocioAlquilerQuery()->filterByPrimaryKeys($socioAlquiler->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterBySocioAlquiler() only accepts arguments of type SocioAlquiler or PropelCollection');
     }
 }
Example #3
0
 /**
  * @param	SocioAlquiler $socioAlquiler The socioAlquiler object to add.
  */
 protected function doAddSocioAlquiler($socioAlquiler)
 {
     $this->collSocioAlquilers[] = $socioAlquiler;
     $socioAlquiler->setPelicula($this);
 }
Example #4
0
 public function executeAlquilarPeliculas(sfWebRequest $request)
 {
     //obtengo socio y todas las peliculas que alquila
     $peliculasId = array();
     $peliculasId = $request->getParameter("id_pelis");
     $socio = $request->getParameter("id_socio");
     //calculo precio total
     $total_a_cobrar = sizeof($peliculasId) * 8;
     //corroboro que las peliculas esten todas libres
     $todo_bien = true;
     foreach ($peliculasId as $peli_id) {
         if ($this->peliculaAlquilada($peli_id)) {
             $todo_bien = false;
         }
     }
     if ($todo_bien) {
         //cargo el alquiler en la base
         $alquiler = new Alquiler();
         $alquiler->setFechaAlquiler(date("d-m-Y"));
         $alquiler->setTotalACobrar($total_a_cobrar);
         $alquiler->setSocioId($socio);
         $alquiler->save();
         //capturo el id de la reserva
         $id_alquiler = $alquiler->getId();
         foreach ($peliculasId as $peli_id) {
             //cargo el alquiler en socio_alquiler
             $socio_alquiler = new SocioAlquiler();
             $socio_alquiler->setAlquilerId($id_alquiler);
             $socio_alquiler->setPeliculaId($peli_id);
             $socio_alquiler->save();
             //marco las peliculas como alquiladas
             $pelicula_alquilada = PeliculaQuery::create()->filterById($peli_id)->update(array('Estado' => 3));
             //marco la reserva como alquilada
             $reserva = ReservasQuery::create()->filterByPeliculaId($peli_id)->filterBySocioId($socio)->filterByAlquilada(false)->filterByExpiroReserva(false)->update(array('Alquilada' => true));
             $this->mje = "Las peliculas: se alquilaron correctamente!!";
         }
     } else {
         $this->mje = "Las peliculas NO se alquilaron!!";
         return sfView::ERROR;
     }
 }