1 | <?php |
||
57 | class RelationLookup extends ActiveRecord implements TypeInterface |
||
58 | { |
||
59 | /** |
||
60 | * The ID of the left business object in the relation. |
||
61 | * |
||
62 | * @var \Alpha\Model\Type\Integer |
||
63 | * |
||
64 | * @since 1.0 |
||
65 | */ |
||
66 | protected $leftID; |
||
67 | |||
68 | /** |
||
69 | * The ID of the right business object in the relation. |
||
70 | * |
||
71 | * @var \Alpha\Model\Type\Integer |
||
72 | * |
||
73 | * @since 1.0 |
||
74 | */ |
||
75 | protected $rightID; |
||
76 | |||
77 | /** |
||
78 | * The name of the left business object class in the relation. |
||
79 | * |
||
80 | * @var string |
||
81 | * |
||
82 | * @since 1.0 |
||
83 | */ |
||
84 | private $leftClassName; |
||
85 | |||
86 | /** |
||
87 | * The name of the right business object class in the relation. |
||
88 | * |
||
89 | * @var string |
||
90 | * |
||
91 | * @since 1.0 |
||
92 | */ |
||
93 | private $rightClassName; |
||
94 | |||
95 | /** |
||
96 | * Trace logger. |
||
97 | * |
||
98 | * @var \Alpha\Util\Logging\Logger |
||
99 | * |
||
100 | * @since 1.0 |
||
101 | */ |
||
102 | private static $logger = null; |
||
|
|||
103 | |||
104 | /** |
||
105 | * an array of data display labels for the class properties. |
||
106 | * |
||
107 | * @var array |
||
108 | * |
||
109 | * @since 1.0 |
||
110 | */ |
||
111 | protected $dataLabels = array('ID' => 'RelationLookup ID#', 'leftID' => 'Left Record ID#', 'rightID' => 'Right Record ID#'); |
||
112 | |||
113 | /** |
||
114 | * The message to display to the user when validation fails. |
||
115 | * |
||
116 | * @var string |
||
117 | * |
||
118 | * @since 1.0 |
||
119 | */ |
||
120 | protected $helper = 'Not a valid RelationLookup value!'; |
||
121 | |||
122 | /** |
||
123 | * The constructor. |
||
124 | * |
||
125 | * @throws \Alpha\Exception\FailedLookupCreateException |
||
126 | * @throws \Alpha\Exception\IllegalArguementException |
||
127 | * |
||
128 | * @since 1.0 |
||
129 | */ |
||
130 | public function __construct($leftClassName, $rightClassName) |
||
168 | |||
169 | /** |
||
170 | * Get the leftClassName value. |
||
171 | * |
||
172 | * @return string |
||
173 | * |
||
174 | * @since 1.0 |
||
175 | */ |
||
176 | public function getLeftClassName() |
||
180 | |||
181 | /** |
||
182 | * Get the rightClassName value. |
||
183 | * |
||
184 | * @return string |
||
185 | * |
||
186 | * @since 1.0 |
||
187 | */ |
||
188 | public function getRightClassName() |
||
192 | |||
193 | /** |
||
194 | * Custom getter for the TABLE_NAME, which can't be static in this class due to |
||
195 | * the lookup tablenames being different each time. |
||
196 | * |
||
197 | * @return string |
||
198 | * |
||
199 | * @since 1.0 |
||
200 | * |
||
201 | * @throws \Alpha\Exception\AlphaException |
||
202 | */ |
||
203 | public function getTableName() |
||
217 | |||
218 | /** |
||
219 | * This custom version provides the left/right class names to the business object constructor, required |
||
220 | * for RelationLookup objects. |
||
221 | * |
||
222 | * (non-PHPdoc) |
||
223 | * |
||
224 | * @see Alpha\Model\ActiveRecord::loadAllByAttribute() |
||
225 | */ |
||
226 | public function loadAllByAttribute($attribute, $value, $start = 0, $limit = 0, $orderBy = 'ID', $order = 'ASC', $ignoreClassType = false, $constructorArgs = array()) |
||
252 | |||
253 | /** |
||
254 | * Getter for the validation helper string. |
||
255 | * |
||
256 | * @return string |
||
257 | * |
||
258 | * @since 1.0 |
||
259 | */ |
||
260 | public function getHelper() |
||
264 | |||
265 | /** |
||
266 | * Set the validation helper text. |
||
267 | * |
||
268 | * @param string $helper |
||
269 | * |
||
270 | * @since 1.0 |
||
271 | */ |
||
272 | public function setHelper($helper) |
||
276 | |||
277 | /** |
||
278 | * Returns an array of the IDs of the related objects. |
||
279 | * |
||
280 | * @return integer[] |
||
281 | * |
||
282 | * @since 1.0 |
||
283 | */ |
||
284 | public function getValue() |
||
288 | |||
289 | /** |
||
290 | * Used to set the IDs of the related objects. Pass a two-item array of IDs, the first |
||
291 | * one being the left object ID, the second being the right. |
||
292 | * |
||
293 | * @param string[] $IDs |
||
294 | * |
||
295 | * @since 1.0 |
||
296 | * |
||
297 | * @throws \Alpha\Exception\IllegalArguementException |
||
298 | */ |
||
299 | public function setValue($IDs) |
||
308 | |||
309 | /** |
||
310 | * Used to convert the object to a printable string. |
||
311 | * |
||
312 | * @return string |
||
313 | * |
||
314 | * @since 1.0 |
||
315 | */ |
||
316 | public function __toString() |
||
320 | } |
||
321 |