from('Pracovnik_kurz u') ->where('u.pracovnik_id = '.$id) ->andWhere('u.kurz_id = '.$id_kurz); return $q; } public function getCurrentKurzOfPracovnik($id){ $q = Doctrine_Query::create() ->select('u.*') ->from('Pracovnik_kurz u,Kurz_beh b') ->where('u.pracovnik_id = '.$id) ->andWhere('b.kurz_id = u.kurz_id') ->andWhere("b.beh_od <= '".date("Y-m-d")."'") ->andWhere("b.beh_do >= '".date("Y-m-d")."'") ->groupBy('b.kurz_id') ->orderBy('b.kurz_id'); return $q; } }