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