Skip to content

[Notifier] Add debugData property to SentMessage class #51746

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ protected function doSend(MessageInterface $message): SentMessage

$sentMessage = new SentMessage($message, (string) $this);
$sentMessage->setMessageId($success['smsId']);
$sentMessage->setDebugData(['response' => $response]);

return $sentMessage;
}
Expand Down
5 changes: 5 additions & 0 deletions src/Symfony/Component/Notifier/Bridge/AllMySms/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========

6.4
---

* Include the http response in the returned `SentMessage` object

6.3
---

Expand Down
5 changes: 5 additions & 0 deletions src/Symfony/Component/Notifier/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========

6.4
---

* Add `debugData` property to `SentMessage` class

6.3
---

Expand Down
11 changes: 11 additions & 0 deletions src/Symfony/Component/Notifier/Message/SentMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class SentMessage
private MessageInterface $original;
private string $transport;
private ?string $messageId = null;
private ?array $debugData = null;

public function __construct(MessageInterface $original, string $transport)
{
Expand All @@ -45,4 +46,14 @@ public function getMessageId(): ?string
{
return $this->messageId;
}

public function getDebugData(): ?array
{
return $this->debugData;
}

public function setDebugData(array $data): void
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should instead be a new constructor argument

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I chose the setter method initially because some transporters may work differently and not have http-response or extra-data to include?

So, it would make sense to make it an optional same as setMessageId()?

Not sure but just clarifying

{
$this->debugData = $data;
}
}