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