Skip to content
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

Throw event before and after sending email #2619

Merged
merged 1 commit into from
Apr 14, 2015
Merged

Throw event before and after sending email #2619

merged 1 commit into from
Apr 14, 2015

Conversation

gonzalovilaseca
Copy link
Contributor

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| License       | MIT

In our app we need to add custom headers before sending emails, and thought this might be something other people could need.

Also in src/Sylius/Bundle/CoreBundle/DependencyInjection/SyliusCoreExtension.php the mailer services where not being loaded (don't know if this is on purpose or not).

@stloyd
Copy link
Contributor

stloyd commented Mar 24, 2015

IMO this should be part of #2482 (ping @amenophis)...

@gonzalovilaseca
Copy link
Contributor Author

Yes, definitively, wasn't aware of that PR!

@stloyd
Copy link
Contributor

stloyd commented Mar 25, 2015

@gonzalovilaseca Can you adjust your PR as the #2482 was merged?

@gonzalovilaseca
Copy link
Contributor Author

Sure!

@gonzalovilaseca
Copy link
Contributor Author

Ok, I've moved the events to an events class instead of the interface and adapted to the new structure. Let me know your thoughts.

@@ -62,7 +64,7 @@ public function render(EmailInterface $email, array $data = array())
}

/** @var EmailEvent $event */
$event = $this->dispatcher->dispatch(self::EVENT_EMAIL_RENDERED, new EmailEvent(new RenderedEmail($subject, $body)));
$event = $this->dispatcher->dispatch(SyliusMailerEvents::EVENT_EMAIL_RENDERED, new EmailRenderEvent(new RenderedEmail($subject, $body)));
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe rename all events like this SyliusMailerEvents::EMAIL_RENDERED ?

Copy link
Member

Choose a reason for hiding this comment

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

👍

@stloyd
Copy link
Contributor

stloyd commented Mar 28, 2015

@pjedrzejewski @Arn0d @amenophis ping ;)

use Sylius\Component\Mailer\Model\EmailInterface;
use Sylius\Component\Mailer\Renderer\Adapter\AbstractAdapter;
use Sylius\Component\Mailer\Renderer\RenderedEmail;
use Sylius\Component\Mailer\SyliusMailerEvents;

/**
* Default Sylius mailer using Twig and SwiftMailer.
Copy link
Contributor

Choose a reason for hiding this comment

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

Bad comment here !

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This comments where in your master, will change them though.

@gonzalovilaseca
Copy link
Contributor Author

PR updated!

pjedrzejewski pushed a commit that referenced this pull request Apr 14, 2015
Throw event before and after sending email
@pjedrzejewski pjedrzejewski merged commit 84e2315 into Sylius:master Apr 14, 2015
@pjedrzejewski
Copy link
Member

Thank you Gonzalo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants