Skip to content

Commit 4f4de92

Browse files
committed
Issue #3157: Correct passing of context.
1 parent 7bb3d07 commit 4f4de92

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/Bridge/Symfony/Messenger/ContextStamp.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,22 @@
2424
*/
2525
final class ContextStamp implements StampInterface
2626
{
27+
/**
28+
* @var array
29+
*/
30+
protected $context;
31+
32+
public function __construct($context = [])
33+
{
34+
$this->context = $context;
35+
}
36+
37+
/**
38+
* Get the context related to a message.
39+
*/
40+
public function getContext(): array
41+
{
42+
return $this->context;
43+
}
44+
2745
}

src/Bridge/Symfony/Messenger/DataPersister.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function persist($data, array $context = [])
7777
{
7878
$envelope = $this->dispatch(
7979
(new Envelope($data))
80-
->with(new ContextStamp())
80+
->with(new ContextStamp($context))
8181
);
8282

8383
$handledStamp = $envelope->last(HandledStamp::class);

0 commit comments

Comments
 (0)