| @@ 53-68 (lines=16) @@ | ||
| 50 | /** |
|
| 51 | * @inheritdoc |
|
| 52 | */ |
|
| 53 | public function applyLabelAdded(LabelEventInterface $labelAdded, Metadata $metadata) |
|
| 54 | { |
|
| 55 | $LabelRelation = $this->createLabelRelation($labelAdded); |
|
| 56 | ||
| 57 | try { |
|
| 58 | if (!is_null($LabelRelation)) { |
|
| 59 | $this->writeRepository->save( |
|
| 60 | $LabelRelation->getLabelName(), |
|
| 61 | $LabelRelation->getRelationType(), |
|
| 62 | $LabelRelation->getRelationId() |
|
| 63 | ); |
|
| 64 | } |
|
| 65 | } catch (UniqueConstraintViolationException $exception) { |
|
| 66 | // By design to catch unique exception. |
|
| 67 | } |
|
| 68 | } |
|
| 69 | ||
| 70 | /** |
|
| 71 | * @inheritdoc |
|
| @@ 73-83 (lines=11) @@ | ||
| 70 | /** |
|
| 71 | * @inheritdoc |
|
| 72 | */ |
|
| 73 | public function applyLabelDeleted(LabelEventInterface $labelDeleted, Metadata $metadata) |
|
| 74 | { |
|
| 75 | $labelRelation = $this->createLabelRelation($labelDeleted); |
|
| 76 | ||
| 77 | if (!is_null($labelRelation)) { |
|
| 78 | $this->writeRepository->deleteByLabelNameAndRelationId( |
|
| 79 | $labelRelation->getLabelName(), |
|
| 80 | $labelRelation->getRelationId() |
|
| 81 | ); |
|
| 82 | } |
|
| 83 | } |
|
| 84 | ||
| 85 | /** |
|
| 86 | * @param EventImportedFromUDB2 $eventImportedFromUDB2 |
|