| @@ 186-194 (lines=9) @@ | ||
| 183 | * |
|
| 184 | * @return Object |
|
| 185 | */ |
|
| 186 | public function insertRecord($entity) |
|
| 187 | { |
|
| 188 | $this->checkIfOriginRecord($entity); |
|
| 189 | $manager = $this->repository->getDocumentManager(); |
|
| 190 | $manager->persist($entity); |
|
| 191 | $manager->flush($entity); |
|
| 192 | ||
| 193 | return $this->find($entity->getId()); |
|
| 194 | } |
|
| 195 | ||
| 196 | /** |
|
| 197 | * @param string $documentId id of entity to find |
|
| @@ 214-224 (lines=11) @@ | ||
| 211 | * |
|
| 212 | * @return Object |
|
| 213 | */ |
|
| 214 | public function updateRecord($documentId, $entity) |
|
| 215 | { |
|
| 216 | $manager = $this->repository->getDocumentManager(); |
|
| 217 | // In both cases the document attribute named originRecord must not be 'core' |
|
| 218 | $this->checkIfOriginRecord($entity); |
|
| 219 | $this->checkIfOriginRecord($this->find($documentId)); |
|
| 220 | $entity = $manager->merge($entity); |
|
| 221 | $manager->flush(); |
|
| 222 | ||
| 223 | return $entity; |
|
| 224 | } |
|
| 225 | ||
| 226 | /** |
|
| 227 | * {@inheritDoc} |
|