tags:

views:

3

answers:

0

Hello,

I have the following Doctrine query:

Doctrine_Query::create()->select('td.*')->from('Model_Transaction t')->innerJoin('t.details td on td.fieldName = ?', 'CALLER_NUMBER')->fetchOne()

The "details" relation is defined like this, in the Model_Transaction_Abstract class:

$this->hasMany('Model_TransactionDetail as details', array(
        'local' => 'id',
        'foreign' => 'trans_d'));

What I would like to do, is obtain only the Model_TransactionDetail object which was fetched in the query. However, I cannot do this, as I get error "The root class of the query (alias t) must have at least one field selected."

Yes, I could reverse join order, but in this case this join would be not as effective, performance-wise.

Do you have any suggestions?