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