private function esLoginCorrecto($usuario, $pass) { $user_ok = SocioQuery::create(); $user_ok->filterByUsuario($usuario); $user_ok->filterByPassword(md5($pass)); $usr = $user_ok->findOne(); return $usr; }
/** * Returns a new SocioQuery object. * * @param string $modelAlias The alias of a model in the query * @param Criteria $criteria Optional Criteria to build the query from * * @return SocioQuery */ public static function create($modelAlias = null, $criteria = null) { if ($criteria instanceof SocioQuery) { return $criteria; } $query = new SocioQuery(); if (null !== $modelAlias) { $query->setModelAlias($modelAlias); } if ($criteria instanceof Criteria) { $query->mergeWith($criteria); } return $query; }
/** * Get the associated Socio object * * @param PropelPDO Optional Connection object. * @return Socio The associated Socio object. * @throws PropelException */ public function getSocio(PropelPDO $con = null) { if ($this->aSocio === null && $this->socio_id !== null) { $this->aSocio = SocioQuery::create()->findPk($this->socio_id, $con); /* The following can be used additionally to guarantee the related object contains a reference to this object. This level of coupling may, however, be undesirable since it could result in an only partially populated collection in the referenced object. $this->aSocio->addComentarios($this); */ } return $this->aSocio; }
public function executePeliculasReservadas(sfWebRequest $requets) { $this->socio = array(); $this->reservas = array(); //busco todas los socios para la simulacion del AJAX del form $consulta = SocioQuery::create(); $consulta->filterByActivo(true); $consulta->orderById(Criteria::DESC); $this->socios = $consulta->find(); //si viene algo por el POST if ($requets->isMethod(sfWebRequest::POST)) { //guardo el dni del socio ingresado $dni = $requets->getParameter('dni'); //si no esta vacío el dni, filtro por esa campo if (!empty($dni) && $dni != '*') { //creo otra consulta para encontrar el socio con ese dni $consulta2 = SocioQuery::create(); $consulta2->filterByDni($dni); $socio = $consulta2->findOne(); $this->socio = $socio; //Guardo el socio en la variable $socId = $socio->getId(); $this->idsoc = $socId; //creo otra consulta para ver las reservas de ese socio $consulta3 = ReservasQuery::create(); $consulta3->usePeliculaQuery(); $consulta3->filterBySocioId($socId); $consulta3->filterByExpiroReserva(false); $consulta3->filterByAlquilada(false); $this->reservas = $consulta3->find(); } } }
/** * Returns the number of related Socio objects. * * @param Criteria $criteria * @param boolean $distinct * @param PropelPDO $con * @return int Count of related Socio objects. * @throws PropelException */ public function countSocios(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) { if (null === $this->collSocios || null !== $criteria) { if ($this->isNew() && null === $this->collSocios) { return 0; } else { $query = SocioQuery::create(null, $criteria); if ($distinct) { $query->distinct(); } return $query->filterByTipoSocio($this)->count($con); } } else { return count($this->collSocios); } }
/** * Removes this object from datastore and sets delete attribute. * * @param PropelPDO $con * @return void * @throws PropelException * @see BaseObject::setDeleted() * @see BaseObject::isDeleted() */ public function delete(PropelPDO $con = null) { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); } if ($con === null) { $con = Propel::getConnection(SocioPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); } $con->beginTransaction(); try { $deleteQuery = SocioQuery::create()->filterByPrimaryKey($this->getPrimaryKey()); $ret = $this->preDelete($con); // symfony_behaviors behavior foreach (sfMixer::getCallables('BaseSocio:delete:pre') as $callable) { if (call_user_func($callable, $this, $con)) { $con->commit(); return; } } if ($ret) { $deleteQuery->delete($con); $this->postDelete($con); // symfony_behaviors behavior foreach (sfMixer::getCallables('BaseSocio:delete:post') as $callable) { call_user_func($callable, $this, $con); } $con->commit(); $this->setDeleted(true); } else { $con->commit(); } } catch (Exception $e) { $con->rollBack(); throw $e; } }