Symfony and Doctrine 1.2.2: How can i get the SQL

2019-06-12 17:10发布

问题:

i have this code:

  $this->lista_miembros = $this->filtro->buildQuery($valores_query);
  var_dump($this->lista_miembros);

var_dump outputs a Doctrine_Query object:

object(Doctrine_Query)[121]
protected '_subqueryAliases' => array

I tried getSql() ...

$q = Doctrine_Query::create()
    ->select('u.id')
    ->from('User u')
    ->whereIn('u.id', array(1, 3, 4, 5));
echo $q->getSql();

..but I dont have that getSql() function!

So how can i get the SQL clause of that Doctrine_Query object?

Javi

回答1:

echo $q->getSqlQuery();