@@ 197-211 (lines=15) @@ | ||
194 | /** |
|
195 | * @inheritDoc |
|
196 | */ |
|
197 | public function createEntry($tableName, array $data) |
|
198 | { |
|
199 | $tableGateway = $this->getTableGateway($tableName); |
|
200 | $data = $this->processData($tableName, $data); |
|
201 | ||
202 | foreach($data as $key => $value) { |
|
203 | if ($value instanceof File) { |
|
204 | $data[$key] = $this->processFile($value); |
|
205 | } |
|
206 | } |
|
207 | ||
208 | $newRecord = $tableGateway->manageRecordUpdate($tableName, $data); |
|
209 | ||
210 | return $this->getEntry($tableName, $newRecord[$tableGateway->primaryKeyFieldName]); |
|
211 | } |
|
212 | ||
213 | /** |
|
214 | * @inheritDoc |
|
@@ 216-230 (lines=15) @@ | ||
213 | /** |
|
214 | * @inheritDoc |
|
215 | */ |
|
216 | public function updateEntry($tableName, $id, array $data) |
|
217 | { |
|
218 | $tableGateway = $this->getTableGateway($tableName); |
|
219 | $data = $this->processData($tableName, $data); |
|
220 | ||
221 | foreach($data as $key => $value) { |
|
222 | if ($value instanceof File) { |
|
223 | $data[$key] = $this->processFile($value); |
|
224 | } |
|
225 | } |
|
226 | ||
227 | $updatedRecord = $tableGateway->manageRecordUpdate($tableName, array_merge($data, ['id' => $id])); |
|
228 | ||
229 | return $this->getEntry($tableName, $updatedRecord[$tableGateway->primaryKeyFieldName]); |
|
230 | } |
|
231 | ||
232 | /** |
|
233 | * @inheritDoc |