@@ 74-83 (lines=10) @@ | ||
71 | return $ret; |
|
72 | } |
|
73 | ||
74 | function getObjectFromCollectionByID($collection, $id) |
|
75 | { |
|
76 | $table = $this->dataSet[$collection]; |
|
77 | $data = $table->read(new \Data\Filter("_id eq $id")); |
|
78 | if(empty($data)) |
|
79 | { |
|
80 | return false; |
|
81 | } |
|
82 | return $data[0]; |
|
83 | } |
|
84 | ||
85 | function addObjectToCollection($collection, $obj) |
|
86 | { |
|
@@ 85-95 (lines=11) @@ | ||
82 | return $data[0]; |
|
83 | } |
|
84 | ||
85 | function addObjectToCollection($collection, $obj) |
|
86 | { |
|
87 | unset($obj['_id']); |
|
88 | $table = $this->dataSet[$collection]; |
|
89 | $res = $table->create($obj); |
|
90 | if($res !== false) |
|
91 | { |
|
92 | return $res; |
|
93 | } |
|
94 | return false; |
|
95 | } |
|
96 | ||
97 | function updateObjectInCollection($collection, $obj) |
|
98 | { |
|
@@ 110-116 (lines=7) @@ | ||
107 | return false; |
|
108 | } |
|
109 | ||
110 | function deleteObjectFromCollection($collection, $obj) |
|
111 | { |
|
112 | $id = $obj['_id']; |
|
113 | unset($obj['_id']); |
|
114 | $table = $this->dataSet[$collection]; |
|
115 | return $table->delete(new \Data\Filter("_id eq $id")); |
|
116 | } |
|
117 | ||
118 | function getAllThemes($year = false) |
|
119 | { |