Skip to content

Commit

Permalink
Merge pull request #116 from Gizra/115-clone-entity
Browse files Browse the repository at this point in the history
Clone the entity prior to adding to the queue.
  • Loading branch information
jhedstrom authored May 7, 2018
2 parents ea91975 + b6f2ab4 commit 64f093b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Subscribers.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,9 @@ public function sendMessage(EntityInterface $entity, MessageInterface $message,
// Add item to the queue.
$task = [
'message' => $message,
'entity' => $entity,
// Clone the entity first to avoid any oddness with serialization.
// @see https://www.drupal.org/project/drupal/issues/2971157
'entity' => clone $entity,
'notify_options' => $notify_options,
'subscribe_options' => $subscribe_options,
'context' => $context,
Expand Down
2 changes: 1 addition & 1 deletion tests/src/Kernel/SubscribersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public function testEntityAccess() {
$message = Message::create(['template' => $this->template->id()]);

$node = $this->nodes[0];
$node->setPublished(FALSE);
$node->setUnpublished();
$node->save();

// Add permission to view own unpublished content.
Expand Down

0 comments on commit 64f093b

Please sign in to comment.