Skip to content

Commit d5bea8d

Browse files
committed
v2.1.5 -- Do not set event slug unless schema has that field in Aggregate::[un]lockNode.
1 parent 437fa31 commit d5bea8d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

CHANGELOG-2.x.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
This changelog references the relevant changes done in 2.x versions.
33

44

5+
## v2.1.5
6+
* Do not set event slug unless schema has that field in `Aggregate::[un]lockNode`.
7+
8+
59
## v2.1.4
610
* Ensure only unique index names are used in `ElasticaNcrSearch::searchNodes`.
711

src/Aggregate.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ public function lockNode(Message $command): void
313313
$this->copyContext($command, $event);
314314
$event->set('node_ref', $this->nodeRef);
315315

316-
if ($this->node->has('slug')) {
316+
if ($this->node->has('slug') && $event::schema()->hasField('slug')) {
317317
$event->set('slug', $this->node->get('slug'));
318318
}
319319

@@ -481,7 +481,7 @@ public function unlockNode(Message $command): void
481481
$this->copyContext($command, $event);
482482
$event->set('node_ref', $this->nodeRef);
483483

484-
if ($this->node->has('slug')) {
484+
if ($this->node->has('slug') && $event::schema()->hasField('slug')) {
485485
$event->set('slug', $this->node->get('slug'));
486486
}
487487

0 commit comments

Comments
 (0)