Skip to content

[Notifier] SentMessage add debug property #49793

@Vincentig

Description

@Vincentig

Description

Some Api like the AllMySms return informations like total of sms sent or the cost. Api

It should be great if we can get those informations in the Notifier SentMessage class.

In the SentMessage of Mailer there is a debug property. I suggest to add this property in the SentMessage of the Notifier componant and to update bridge transport like AllMySmsTransport to update this property.

Maybe debug property is not the best property.

Thanks.

Example

namespace Symfony\Component\Notifier\Message;

class SentMessage
{
    private MessageInterface $original;
    private string $transport;
    private ?string $messageId = null;
    ...
    private ?array $debug = null;
    ...
    public function getDebug(): array
    {
        return $this->debug;
    }
    public function setDebug(array $debug): void
    {
        $this->debug = $debug;
    }
    ...
namespace Symfony\Component\Notifier\Bridge\AllMySms;

final class AllMySmsTransport extends AbstractTransport
{
    ...
    protected function doSend(MessageInterface $message): SentMessage
    {
    ...
    $success = $response->toArray(false);
    ...
    $sentMessage = new SentMessage($message, (string) $this);
    $sentMessage->setMessageId($success['smsId']);
    
    $sentMessage->setDebug($success);
    ...
    }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions