Subquery Doctrine Couldn't find class
Posted
by yosesita
on Stack Overflow
See other posts from Stack Overflow
or by yosesita
Published on 2010-05-03T22:03:11Z
Indexed on
2010/05/03
22:08 UTC
Read the original article
Hit count: 243
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 !
© Stack Overflow or respective owner