19
19
=========================================================================*/
20
20
21
21
/**
22
- * Global dao methods
22
+ * Generic DAO base class.
23
+ *
24
+ * @package Core\DAO
23
25
*/
24
26
class MIDAS_GlobalDao
25
27
{
28
+ /** @var string */
26
29
protected $ key ;
27
30
28
- /**
29
- * Construct dao
30
- */
31
+ /** Constructor */
31
32
public function __construct ()
32
33
{
33
34
if ($ this ->getModel ()->getKey () !== '' ) {
@@ -39,9 +40,7 @@ public function __construct()
39
40
$ this ->loadElements ();
40
41
}
41
42
42
- /**
43
- * Loads model and components
44
- */
43
+ /** Load the components. */
45
44
public function loadElements ()
46
45
{
47
46
Zend_Registry::set ('components ' , array ());
@@ -58,9 +57,11 @@ public function loadElements()
58
57
}
59
58
60
59
/**
61
- * Init the dao based on the primary key
60
+ * Initialize the DAO from the primary key.
62
61
*
63
- * @param $key Primary Key
62
+ * @param string $key primary key with which to initialize the DAO
63
+ * @return bool true if the DAO is successfully initialized
64
+ * @throws Zend_Exception
64
65
*/
65
66
public function initValues ($ key )
66
67
{
@@ -82,7 +83,11 @@ public function initValues($key)
82
83
return true ;
83
84
}
84
85
85
- /** return values as an array */
86
+ /**
87
+ * Return the names and values of the fields of the DAO as an associative array.
88
+ *
89
+ * @return array
90
+ */
86
91
public function toArray ()
87
92
{
88
93
$ return = array ();
@@ -99,9 +104,10 @@ public function toArray()
99
104
}
100
105
101
106
/**
102
- * Return key value
107
+ * Return the value of the key field of the DAO.
103
108
*
104
- * @return key
109
+ * @return mixed
110
+ * @throws Zend_Exception
105
111
*/
106
112
public function getKey ()
107
113
{
@@ -114,10 +120,11 @@ public function getKey()
114
120
}
115
121
116
122
/**
117
- * Generic get function. You can define custom function .
123
+ * Return the value of a field of the DAO .
118
124
*
119
- * @param $var name of the element we want to get
120
- * @return value
125
+ * @param string $var name of the field of which to return the value
126
+ * @return mixed
127
+ * @throws Zend_Exception
121
128
*/
122
129
public function get ($ var )
123
130
{
@@ -144,10 +151,12 @@ public function get($var)
144
151
}
145
152
146
153
/**
147
- * Set a value
154
+ * Set the value of a field of the DAO.
148
155
*
149
- * @param $var name of the element we want to set
150
- * @param $value
156
+ * @param string $var name of the field of which to set the value
157
+ * @param mixed $value value of the field
158
+ * @return void|mixed
159
+ * @throws Zend_Exception
151
160
*/
152
161
public function set ($ var , $ value )
153
162
{
@@ -164,9 +173,10 @@ public function set($var, $value)
164
173
}
165
174
166
175
/**
167
- * Get Model
176
+ * Return a model.
168
177
*
169
- * @return model
178
+ * @param string|null $name name of the model
179
+ * @return object
170
180
*/
171
181
public function getModel ($ name = null )
172
182
{
@@ -185,7 +195,7 @@ public function getModel($name = null)
185
195
}
186
196
187
197
/**
188
- * Get Logger
198
+ * Fetch the logger from the Zend registry.
189
199
*
190
200
* @return Zend_Log
191
201
*/
@@ -195,11 +205,12 @@ public function getLogger()
195
205
}
196
206
197
207
/**
198
- * Catch if the method does not exist and create a method dynamically
208
+ * Invoke inaccessible methods.
199
209
*
200
- * @param $method method name
201
- * @param $params array of param
202
- * @return return the result of the function dynamically created
210
+ * @param string $method name of the method
211
+ * @param array $params parameters of the method
212
+ * @return mixed
213
+ * @throws Zend_Exception
203
214
*/
204
215
public function __call ($ method , $ params )
205
216
{
@@ -233,8 +244,10 @@ public function __call($method, $params)
233
244
}
234
245
235
246
/**
236
- * @param $var name
237
- * @return real var
247
+ * Return a method name given the name of an item of data in a model.
248
+ *
249
+ * @param string $var name of an item of data
250
+ * @return string
238
251
*/
239
252
private function _getRealName ($ var )
240
253
{
0 commit comments