| @@ 223-231 (lines=9) @@ | ||
| 220 | * |
|
| 221 | * @return Object |
|
| 222 | */ |
|
| 223 | public function insertRecord($entity) |
|
| 224 | { |
|
| 225 | $this->checkIfOriginRecord($entity); |
|
| 226 | $manager = $this->repository->getDocumentManager(); |
|
| 227 | $manager->persist($entity); |
|
| 228 | $manager->flush($entity); |
|
| 229 | ||
| 230 | return $this->find($entity->getId()); |
|
| 231 | } |
|
| 232 | ||
| 233 | /** |
|
| 234 | * @param string $documentId id of entity to find |
|
| @@ 251-261 (lines=11) @@ | ||
| 248 | * |
|
| 249 | * @return Object |
|
| 250 | */ |
|
| 251 | public function updateRecord($documentId, $entity) |
|
| 252 | { |
|
| 253 | $manager = $this->repository->getDocumentManager(); |
|
| 254 | // In both cases the document attribute named originRecord must not be 'core' |
|
| 255 | $this->checkIfOriginRecord($entity); |
|
| 256 | $this->checkIfOriginRecord($this->find($documentId)); |
|
| 257 | $entity = $manager->merge($entity); |
|
| 258 | $manager->flush(); |
|
| 259 | ||
| 260 | return $entity; |
|
| 261 | } |
|
| 262 | ||
| 263 | /** |
|
| 264 | * {@inheritDoc} |
|