| @@ 63-79 (lines=17) @@ | ||
| 60 | /** |
|
| 61 | * @inheritdoc |
|
| 62 | */ |
|
| 63 | public function applyLabelAdded(LabelEventInterface $labelAdded, Metadata $metadata) |
|
| 64 | { |
|
| 65 | $LabelRelation = $this->createLabelRelation($labelAdded); |
|
| 66 | ||
| 67 | try { |
|
| 68 | if (!is_null($LabelRelation)) { |
|
| 69 | $this->writeRepository->save( |
|
| 70 | $LabelRelation->getLabelName(), |
|
| 71 | $LabelRelation->getRelationType(), |
|
| 72 | $LabelRelation->getRelationId(), |
|
| 73 | false |
|
| 74 | ); |
|
| 75 | } |
|
| 76 | } catch (UniqueConstraintViolationException $exception) { |
|
| 77 | // By design to catch unique exception. |
|
| 78 | } |
|
| 79 | } |
|
| 80 | ||
| 81 | /** |
|
| 82 | * @inheritdoc |
|
| @@ 84-94 (lines=11) @@ | ||
| 81 | /** |
|
| 82 | * @inheritdoc |
|
| 83 | */ |
|
| 84 | public function applyLabelRemoved(LabelEventInterface $labelRemoved, Metadata $metadata) |
|
| 85 | { |
|
| 86 | $labelRelation = $this->createLabelRelation($labelRemoved); |
|
| 87 | ||
| 88 | if (!is_null($labelRelation)) { |
|
| 89 | $this->writeRepository->deleteByLabelNameAndRelationId( |
|
| 90 | $labelRelation->getLabelName(), |
|
| 91 | $labelRelation->getRelationId() |
|
| 92 | ); |
|
| 93 | } |
|
| 94 | } |
|
| 95 | ||
| 96 | /** |
|
| 97 | * @param EventImportedFromUDB2 $eventImportedFromUDB2 |
|