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