1 : <?php
2 :
3 0 : Doctrine_Manager::getInstance()->bindComponent('Workshops', 'doctrine');
4 :
5 :
6 :
7 :
8 :
9 :
10 :
11 :
12 :
13 :
14 :
15 :
16 :
17 :
18 :
19 :
20 :
21 :
22 :
23 :
24 :
25 :
26 :
27 :
28 :
29 :
30 : abstract class BaseWorkshops extends Doctrine_Record
31 0 : {
32 : public function setTableDefinition()
33 : {
34 0 : $this->setTableName('workshops');
35 0 : $this->hasColumn('id', 'integer', 4, array(
36 0 : 'type' => 'integer',
37 0 : 'fixed' => 0,
38 0 : 'unsigned' => true,
39 0 : 'primary' => true,
40 0 : 'autoincrement' => true,
41 0 : 'length' => '4',
42 0 : ));
43 0 : $this->hasColumn('category_id', 'integer', 4, array(
44 0 : 'type' => 'integer',
45 0 : 'fixed' => 0,
46 0 : 'unsigned' => true,
47 0 : 'primary' => false,
48 0 : 'notnull' => true,
49 0 : 'autoincrement' => false,
50 0 : 'length' => '4',
51 0 : ));
52 0 : $this->hasColumn('name', 'string', 45, array(
53 0 : 'type' => 'string',
54 0 : 'fixed' => 0,
55 0 : 'unsigned' => false,
56 0 : 'primary' => false,
57 0 : 'notnull' => true,
58 0 : 'autoincrement' => false,
59 0 : 'length' => '45',
60 0 : ));
61 0 : $this->hasColumn('start_date', 'date', 25, array(
62 0 : 'type' => 'date',
63 0 : 'fixed' => 0,
64 0 : 'unsigned' => false,
65 0 : 'primary' => false,
66 0 : 'notnull' => true,
67 0 : 'autoincrement' => false,
68 0 : 'length' => '25',
69 0 : ));
70 0 : $this->hasColumn('end_date', 'date', 25, array(
71 0 : 'type' => 'date',
72 0 : 'fixed' => 0,
73 0 : 'unsigned' => false,
74 0 : 'primary' => false,
75 0 : 'notnull' => true,
76 0 : 'autoincrement' => false,
77 0 : 'length' => '25',
78 0 : ));
79 0 : $this->hasColumn('notes', 'string', null, array(
80 0 : 'type' => 'string',
81 0 : 'fixed' => 0,
82 0 : 'unsigned' => false,
83 0 : 'primary' => false,
84 0 : 'notnull' => true,
85 0 : 'autoincrement' => false,
86 0 : 'length' => '',
87 0 : ));
88 0 : $this->hasColumn('double_price', 'integer', 4, array(
89 0 : 'type' => 'integer',
90 0 : 'fixed' => 0,
91 0 : 'unsigned' => false,
92 0 : 'primary' => false,
93 0 : 'notnull' => true,
94 0 : 'autoincrement' => false,
95 0 : 'length' => '4',
96 0 : ));
97 0 : $this->hasColumn('single_price', 'integer', 4, array(
98 0 : 'type' => 'integer',
99 0 : 'fixed' => 0,
100 0 : 'unsigned' => false,
101 0 : 'primary' => false,
102 0 : 'notnull' => true,
103 0 : 'autoincrement' => false,
104 0 : 'length' => '4',
105 0 : ));
106 0 : $this->hasColumn('extra_price', 'integer', 4, array(
107 0 : 'type' => 'integer',
108 0 : 'fixed' => 0,
109 0 : 'unsigned' => false,
110 0 : 'primary' => false,
111 0 : 'notnull' => true,
112 0 : 'autoincrement' => false,
113 0 : 'length' => '4',
114 0 : ));
115 0 : $this->hasColumn('date_created', 'timestamp', 25, array(
116 0 : 'type' => 'timestamp',
117 0 : 'fixed' => 0,
118 0 : 'unsigned' => false,
119 0 : 'primary' => false,
120 0 : 'notnull' => false,
121 0 : 'autoincrement' => false,
122 0 : 'length' => '25',
123 0 : ));
124 0 : $this->hasColumn('last_update', 'timestamp', 25, array(
125 0 : 'type' => 'timestamp',
126 0 : 'fixed' => 0,
127 0 : 'unsigned' => false,
128 0 : 'primary' => false,
129 0 : 'notnull' => true,
130 0 : 'autoincrement' => false,
131 0 : 'length' => '25',
132 0 : ));
133 0 : }
134 :
135 : public function setUp()
136 : {
137 0 : parent::setUp();
138 0 : $this->hasOne('Categories', array(
139 0 : 'local' => 'category_id',
140 0 : 'foreign' => 'id'));
141 :
142 0 : $this->hasMany('Prices', array(
143 0 : 'local' => 'id',
144 0 : 'foreign' => 'workshop_id'));
145 :
146 0 : $this->hasMany('Registered', array(
147 0 : 'local' => 'id',
148 0 : 'foreign' => 'workshop_id'));
149 0 : }
|