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