| @@ 36-46 (lines=11) @@ | ||
| 33 | * |
|
| 34 | * @throws ObjectClassNotAllowedException |
|
| 35 | */ |
|
| 36 | public function insert(Entity $object) |
|
| 37 | { |
|
| 38 | if (!$this->getSupport($object)) { |
|
| 39 | throw new ObjectClassNotAllowedException(); |
|
| 40 | } |
|
| 41 | $object->setCreatedAt(new DateTime()); |
|
| 42 | $this->entityManager->persist($object); |
|
| 43 | $this->entityManager->flush(); |
|
| 44 | ||
| 45 | return $object; |
|
| 46 | } |
|
| 47 | ||
| 48 | /** |
|
| 49 | * @param Entity $object |
|
| @@ 55-64 (lines=10) @@ | ||
| 52 | * |
|
| 53 | * @throws ObjectClassNotAllowedException |
|
| 54 | */ |
|
| 55 | public function update(Entity $object) |
|
| 56 | { |
|
| 57 | if (!$this->getSupport($object)) { |
|
| 58 | throw new ObjectClassNotAllowedException(); |
|
| 59 | } |
|
| 60 | $object->setUpdatedAt(new DateTime()); |
|
| 61 | $this->entityManager->flush(); |
|
| 62 | ||
| 63 | return $object; |
|
| 64 | } |
|
| 65 | ||
| 66 | /** |
|
| 67 | * @param Entity $object |
|