Details
-
Type:
Bug
-
Status:
Reopened
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.2.2
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
Description
I'm trying to create a query like this one :
SELECT nombre, (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) as total from provincia p
$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'.
You are using table names in your query and not model names.
For future reference, the Jira is for reporting bugs/issues. You can ask user questions on the Doctrine mailing lists: http://www.doctrine-project.org/community