views:

34

answers:

1

Hi,

for a doctrine model I'm making I don't always need to fetch all the columns I was hoping that I could solve this using

$query = Doctrine_Query::create()
->select('a');
if(!empty($value)){
$query->select('b');
}
$query->execute();

but this does not work...

Does anyone have a clue how this could be done?

+1  A: 

Try using $query->addSelect('b') instead of $query->select('b').

Philippe Gerber