1 : <?php
2 :
3 :
4 :
5 :
6 :
7 :
8 :
9 :
10 :
11 :
12 :
13 0 : class Workshops extends BaseWorkshops {
14 :
15 : public static function findAll() {
16 0 : return Doctrine_Core::getTable('Workshops')->findAll();
17 : }
18 :
19 : public static function findAllAfterToday() {
20 0 : $today = date('Y-m-d');
21 0 : return Doctrine_Query::create()
22 0 : ->select('i.*, c.*, w.*')
23 0 : ->from('Instructors i')
24 0 : ->leftJoin('i.Categories c')
25 0 : ->leftJoin('c.Workshops w')
26 0 : ->where('w.start_date > ?', $today)
27 0 : ->execute();
28 :
29 : }
30 :
31 : public static function findAllFromUserAfterToday($userId) {
32 :
33 0 : $today = date('Y-m-d', strtotime(date('Y-m-d')));
34 0 : return Doctrine_Query::create()
35 0 : ->select('w.*, r.date_registered')
36 0 : ->from('Workshops w')
37 0 : ->leftJoin('w.Registered r')
38 0 : ->having('r.user_id = ?', array(1))
39 0 : ->where('w.start_date > ?', array("$today"))
40 0 : ->execute();
41 :
42 : }
43 :
44 : public static function findByIdent($ident) {
45 0 : return Doctrine_Core::getTable('Workshops')->findOneBy('ident', $ident);
46 : }
47 :
48 : public static function findByIdJoinInstructorCategory($id) {
49 0 : $today = date('Y-m-d');
50 0 : return Doctrine_Query::create()
51 0 : ->select('w.*, c.*, i.*')
52 0 : ->from('Workshops w')
53 0 : ->leftJoin('w.Categories c')
54 0 : ->leftJoin('c.Instructors i')
55 0 : ->where('w.id = ?', $id)
56 0 : ->andWhere('w.start_date > ?' ,$today)
57 0 : ->execute();
58 :
59 : }
60 :
61 : }
|