multiple ->select() in doctrine query
For a doctrine model, 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?
Try using $query->addSelect('b')
instead of $query->select('b')
.
精彩评论