$tplCount = Doctrine_Query::create() ->from('Tournament t') ->innerjoin('t.PlayerLink tpl') ->innerjoin('tpl.Player p') ->where('t.date = ? AND t.site_id = ? AND t.buyin_id = ?', array($dateTime, $siteId, $buyinId)) ->addWhere('tpl.tournament_id = ?', $tourneyId) ->addWhere('p.user_id = ?', $userId) ->count();