Total Complexity | 6 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
2 | class VolunteerObject |
||
3 | { |
||
4 | protected $tableName; |
||
5 | protected $dbData; |
||
6 | protected $index; |
||
7 | protected $id; |
||
8 | |||
9 | public function __construct($id, $dbData, $tableName, $index) |
||
10 | { |
||
11 | $this->tableName = $tableName; |
||
12 | $this->index = $index; |
||
13 | if($dbData === null) |
||
14 | { |
||
15 | $dataTable = DataSetFactory::getDataTableByNames('fvs', $tableName); |
||
16 | $filter = new \Data\Filter($index.' eq '.$id); |
||
17 | $objs = $dataTable->read($filter); |
||
18 | if(empty($objs)) |
||
19 | { |
||
20 | throw new Exception('Unable to locate object with ID '.$id); |
||
21 | } |
||
22 | $dbData = $objs[0]; |
||
23 | $this->id = $id; |
||
24 | } |
||
25 | else |
||
26 | { |
||
27 | $this->id = $dbData[$index]; |
||
28 | } |
||
29 | $this->dbData = $dbData; |
||
30 | } |
||
31 | |||
32 | public function getDataTable() |
||
35 | } |
||
36 | |||
37 | public function getDataFilter() |
||
40 | } |
||
41 | |||
42 | public function __get($propName) |
||
47 |