Conditions | 3 |
Paths | 3 |
Total Lines | 21 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
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 | } |
||
47 |