SendMessageToTransportsEvent.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Messenger\Event;
  11. use Symfony\Component\Messenger\Envelope;
  12. /**
  13. * Event is dispatched before a message is sent to the transport.
  14. *
  15. * The event is *only* dispatched if the message will actually
  16. * be sent to at least one transport. If the message is sent
  17. * to multiple transports, the message is dispatched only one time.
  18. * This message is only dispatched the first time a message
  19. * is sent to a transport, not also if it is retried.
  20. *
  21. * @author Ryan Weaver <ryan@symfonycasts.com>
  22. */
  23. final class SendMessageToTransportsEvent
  24. {
  25. private $envelope;
  26. public function __construct(Envelope $envelope)
  27. {
  28. $this->envelope = $envelope;
  29. }
  30. public function getEnvelope(): Envelope
  31. {
  32. return $this->envelope;
  33. }
  34. public function setEnvelope(Envelope $envelope)
  35. {
  36. $this->envelope = $envelope;
  37. }
  38. }