开发者

Can someone explain why the following DQL works?

$user = Doctrine_Core::getTable开发者_如何学运维('User')
    ->createQuery('u')
    ->innerJoin('u.Profile p')
    ->where('p.username = ?', 'jwage')
    ->fetchOne();

It looks quite different from SQL which I'm quite used to,especially what does the u mean?

Can someone make it clear by a decent explanation?


$q = Doctrine::getTable('User')->createQuery('u')->where('u.username = ?', 'JRL');

is a shorthand method for this:

$q = Doctrine_Query::create()->from('User u')->where('u.username = ?', 'JRL');

The createQuery method is declared as such: createQuery($alias = '')


Seems to me like the u means the User table. It's just a short alias for it.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜