Hi,

I'm using Symfony 1.4 with Doctrine.

I have a table named ExchServer, and I defined this functions to get
only the registers that has de active field set.

class ExchServerTable extends PluginExchServerTable
{
  public function getActive( Doctrine_Query $q = null )
  {
    return $this->addActiveQuery( $q )->execute();
  }

  public Function addActiveQuery( Doctrine_Query $q = null )
  {
    if (is_null($q))
    {
      $q = $this->createQuery('a');
    }
    $alias = $q->getRootAlias();
    $q->andWhere($alias.'.active');
    return $q;
  }
}

In the module actions call:

class exch_serverActions extends sfActions
{
  public function executeIndex(sfWebRequest $request)
  {
    $this->exch_servers = Doctrine::getTable('ExchServer')-
>getActive();
  }
}

When I run the aplication, i've got the next error:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'a.active' in
'where clause'. Failing Query: "SELECT e.id AS e__id, e.name AS
e__name, e.dn AS e__dn, e.exchdn AS e__exchdn, e.created_at AS
e__created_at, e.updated_at AS e__updated_at, e.active AS e__active
FROM exch_server e WHERE (a.active)"

You could use any alias for the query 'a', 'b', .., all except 'e'
fails.
And 'e' works because is the initial of the table name. ( Check
Doctrine/Query.php line #500 )

Is this a bug, or I'm doing anything wrong ?

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to