Query con Doctrine en Form
Versión 1 (Guillermo Zdanowicz, 14/06/2012 08:58)
| 1 | 1 | Guillermo Zdanowicz | h1. Query con Doctrine en Form |
|---|---|---|---|
| 2 | 1 | Guillermo Zdanowicz | |
| 3 | 1 | Guillermo Zdanowicz | public function obtenerPlanillasAreaAsignadas($area) |
| 4 | 1 | Guillermo Zdanowicz | { |
| 5 | 1 | Guillermo Zdanowicz | |
| 6 | 1 | Guillermo Zdanowicz | $q = Doctrine_Query::create() |
| 7 | 1 | Guillermo Zdanowicz | ->from('Planillas p'); |
| 8 | 1 | Guillermo Zdanowicz | |
| 9 | 1 | Guillermo Zdanowicz | $planillas_asignadas = $q->createSubquery() |
| 10 | 1 | Guillermo Zdanowicz | ->select('pa.planillas_id') |
| 11 | 1 | Guillermo Zdanowicz | ->from('PlanillasAreas pa') |
| 12 | 1 | Guillermo Zdanowicz | ->where('pa.areas_id = ?'); |
| 13 | 1 | Guillermo Zdanowicz | |
| 14 | 1 | Guillermo Zdanowicz | $q->where('p.id IN (' . $planillas_asignadas->getDql() . ')'); |
| 15 | 1 | Guillermo Zdanowicz | |
| 16 | 1 | Guillermo Zdanowicz | return $q->execute(array($area)); |
| 17 | 1 | Guillermo Zdanowicz | |
| 18 | 1 | Guillermo Zdanowicz | } |