Criteriocustom
De CidesaWiki
(Diferencias entre revisiones)
| Línea 10: | Línea 10: | ||
$c->add(TablaPeer::Campo, $this->sql, Criteria::CUSTOM); | $c->add(TablaPeer::Campo, $this->sql, Criteria::CUSTOM); | ||
$this->rs= TablaPeer::doSelect($c); | $this->rs= TablaPeer::doSelect($c); | ||
| - | //Hacer Validacion del | + | //Hacer Validacion del rs |
} | } | ||
</pre> | </pre> | ||
Revisión de 19:27 23 mar 2007
La funion personalisa tu busqueda utilizando el criteria <<<Jaime Suarez>>>>
public function getFuncion()
{
// funcion custom
$c = new Criteria;
//creamos la sentencia auxiliar
$this->sql = "Tabla.Campo=(Select * from tabla_name where campo=rpad('".$this->tabla->getOtro_campo()."',10,' '))";
$c->add(TablaPeer::Campo, $this->sql, Criteria::CUSTOM);
$this->rs= TablaPeer::doSelect($c);
//Hacer Validacion del rs
}
nota: Tabla.Campo Pertenece TablaPeer osea quedaria en sql
SELECT * FROM Tabla WHERE Tabla.Campo=(Select campo from tabla_name where campo=rpad('".$this->tabla->getOtro_campo()."',10,' '))";