Subquery Doctrine Couldn't find class
- by yosesita
I'm trying to create a query like this one :
$q = Doctrine_Query::create()
-select('p.nombre')
-addSelect('(select count(*) from alojamiento a left join
localidad l on a.localidad_id=l.id where p.id=l.provincia_id and
a.activo=true)')
-from('provincia p');
but it fails : error 500, couldn't find class a.
And :
$q = Doctrine_Query::create()
-select('nombre')
-addSelect('(select count(*) from alojamiento left join localidad on
alojamiento.localidad_id=localidad.id where
provincia.id=localidad.provincia_id and alojamiento.activo=true)')
-from('provincia');
leads to : SQLSTATE[42S22]: Column not found: 1054 Unknown column 'a.localidad_id' in 'on clause'.
Any help would be greatly appreciated !