tags:

views:

42

answers:

2
$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?

A: 

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

Veeti
+1  A: 
$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 = '')

JRL