开发者

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').

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜