Doctrine: Unknown table alias. Is this DQL correct?

Posted by ropstah on Stack Overflow See other posts from Stack Overflow or by ropstah
Published on 2010-04-16T00:39:38Z Indexed on 2010/04/16 0:43 UTC
Read the original article Hit count: 342

Filed under:
|

I'm trying to execute a query but I get an error:

Unknown table alias

The tables are setup as follows:

Template_Spot hasOne  Template
Template      hasMany Template_Spot
Template      hasMany Location
Location      hasOne  Template

I'm trying to execute the following DQL:

$locationid = 1;
$spots = Doctrine_Query::create()
    ->select('cts.*, ct.*, uc.*')
    ->from('Template_Spot cts')
    ->innerJoin('Template ct')
    ->innerJoin('Location uc')
    ->where('uc.locationid = ?', $locationid)->execute();

Does anyone spot a problem?

© Stack Overflow or respective owner

Related posts about doctrine

Related posts about dql