diff --git a/composer.json b/composer.json
index a77e8368d5..6e76637945 100644
--- a/composer.json
+++ b/composer.json
@@ -54,6 +54,8 @@
"swiftmailer/swiftmailer": "^6.0",
"sylius-labs/association-hydrator": "^1.0",
"sylius/fixtures-bundle": "~1.1.15",
+ "sylius/mailer": "~1.1.15",
+ "sylius/mailer-bundle": "~1.1.15",
"sylius/registry": "~1.1.15",
"sylius/theme-bundle": "~1.1.15",
"symfony/monolog-bundle": "^3.0",
@@ -122,8 +124,6 @@
"sylius/inventory-bundle": "self.version",
"sylius/locale": "self.version",
"sylius/locale-bundle": "self.version",
- "sylius/mailer": "self.version",
- "sylius/mailer-bundle": "self.version",
"sylius/money-bundle": "self.version",
"sylius/order": "self.version",
"sylius/order-bundle": "self.version",
diff --git a/phpspec.yml.dist b/phpspec.yml.dist
index 2e774f904d..24ab9bf639 100644
--- a/phpspec.yml.dist
+++ b/phpspec.yml.dist
@@ -8,7 +8,6 @@ suites:
Grid: { namespace: Sylius\Component\Grid, psr4_prefix: Sylius\Component\Grid, spec_path: src/Sylius/Component/Grid, src_path: src/Sylius/Component/Grid }
Inventory: { namespace: Sylius\Component\Inventory, psr4_prefix: Sylius\Component\Inventory, spec_path: src/Sylius/Component/Inventory, src_path: src/Sylius/Component/Inventory }
Locale: { namespace: Sylius\Component\Locale, psr4_prefix: Sylius\Component\Locale, spec_path: src/Sylius/Component/Locale, src_path: src/Sylius/Component/Locale }
- Mailer: { namespace: Sylius\Component\Mailer, psr4_prefix: Sylius\Component\Mailer, spec_path: src/Sylius/Component/Mailer, src_path: src/Sylius/Component/Mailer }
Order: { namespace: Sylius\Component\Order, psr4_prefix: Sylius\Component\Order, spec_path: src/Sylius/Component/Order, src_path: src/Sylius/Component/Order }
Payment: { namespace: Sylius\Component\Payment, psr4_prefix: Sylius\Component\Payment, spec_path: src/Sylius/Component/Payment, src_path: src/Sylius/Component/Payment }
Product: { namespace: Sylius\Component\Product, psr4_prefix: Sylius\Component\Product, spec_path: src/Sylius/Component/Product, src_path: src/Sylius/Component/Product }
@@ -31,7 +30,6 @@ suites:
GridBundle: { namespace: Sylius\Bundle\GridBundle, psr4_prefix: Sylius\Bundle\GridBundle, spec_path: src/Sylius/Bundle/GridBundle, src_path: src/Sylius/Bundle/GridBundle }
InventoryBundle: { namespace: Sylius\Bundle\InventoryBundle, psr4_prefix: Sylius\Bundle\InventoryBundle, spec_path: src/Sylius/Bundle/InventoryBundle, src_path: src/Sylius/Bundle/InventoryBundle }
LocaleBundle: { namespace: Sylius\Bundle\LocaleBundle, psr4_prefix: Sylius\Bundle\LocaleBundle, spec_path: src/Sylius/Bundle/LocaleBundle, src_path: src/Sylius/Bundle/LocaleBundle }
- MailerBundle: { namespace: Sylius\Bundle\MailerBundle, psr4_prefix: Sylius\Bundle\MailerBundle, spec_path: src/Sylius/Bundle/MailerBundle, src_path: src/Sylius/Bundle/MailerBundle }
MoneyBundle: { namespace: Sylius\Bundle\MoneyBundle, psr4_prefix: Sylius\Bundle\MoneyBundle, spec_path: src/Sylius/Bundle/MoneyBundle, src_path: src/Sylius/Bundle/MoneyBundle }
OrderBundle: { namespace: Sylius\Bundle\OrderBundle, psr4_prefix: Sylius\Bundle\OrderBundle, spec_path: src/Sylius/Bundle/OrderBundle, src_path: src/Sylius/Bundle/OrderBundle }
PaymentBundle: { namespace: Sylius\Bundle\PaymentBundle, psr4_prefix: Sylius\Bundle\PaymentBundle, spec_path: src/Sylius/Bundle/PaymentBundle, src_path: src/Sylius/Bundle/PaymentBundle }
diff --git a/src/Sylius/Bundle/MailerBundle/.gitignore b/src/Sylius/Bundle/MailerBundle/.gitignore
deleted file mode 100644
index 254bd6627f..0000000000
--- a/src/Sylius/Bundle/MailerBundle/.gitignore
+++ /dev/null
@@ -1,8 +0,0 @@
-vendor/
-bin/
-
-composer.phar
-composer.lock
-
-test/app/cache
-test/app/logs
\ No newline at end of file
diff --git a/src/Sylius/Bundle/MailerBundle/DependencyInjection/Configuration.php b/src/Sylius/Bundle/MailerBundle/DependencyInjection/Configuration.php
deleted file mode 100644
index 0eab1cbd6b..0000000000
--- a/src/Sylius/Bundle/MailerBundle/DependencyInjection/Configuration.php
+++ /dev/null
@@ -1,79 +0,0 @@
-root('sylius_mailer');
-
- $rootNode
- ->children()
- ->scalarNode('sender_adapter')->defaultValue('sylius.email_sender.adapter.swiftmailer')->end()
- ->scalarNode('renderer_adapter')->defaultValue('sylius.email_renderer.adapter.twig')->end()
- ->end()
- ;
-
- $this->addEmailsSection($rootNode);
-
- return $treeBuilder;
- }
-
- /**
- * @param ArrayNodeDefinition $node
- */
- private function addEmailsSection(ArrayNodeDefinition $node): void
- {
- $node
- ->children()
- ->arrayNode('sender')
- ->addDefaultsIfNotSet()
- ->children()
- ->scalarNode('name')->defaultValue('Example.com Store')->end()
- ->scalarNode('address')->defaultValue('no-reply@example.com')->end()
- ->end()
- ->end()
- ->arrayNode('emails')
- ->useAttributeAsKey('code')
- ->arrayPrototype()
- ->children()
- ->scalarNode('subject')->cannotBeEmpty()->end()
- ->scalarNode('template')->cannotBeEmpty()->end()
- ->booleanNode('enabled')->defaultTrue()->end()
- ->arrayNode('sender')
- ->children()
- ->scalarNode('name')->end()
- ->scalarNode('address')->end()
- ->end()
- ->end()
- ->end()
- ->end()
- ->end()
- ->arrayNode('templates')
- ->useAttributeAsKey('name')
- ->scalarPrototype()->end()
- ->end()
- ->end()
- ;
- }
-}
diff --git a/src/Sylius/Bundle/MailerBundle/DependencyInjection/SyliusMailerExtension.php b/src/Sylius/Bundle/MailerBundle/DependencyInjection/SyliusMailerExtension.php
deleted file mode 100644
index a779e286e3..0000000000
--- a/src/Sylius/Bundle/MailerBundle/DependencyInjection/SyliusMailerExtension.php
+++ /dev/null
@@ -1,50 +0,0 @@
-processConfiguration($this->getConfiguration([], $container), $config);
- $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
-
- $configFiles = [
- 'services.xml',
- ];
-
- foreach ($configFiles as $configFile) {
- $loader->load($configFile);
- }
-
- $container->setAlias('sylius.email_sender.adapter', $config['sender_adapter']);
- $container->setAlias('sylius.email_renderer.adapter', $config['renderer_adapter']);
-
- $container->setParameter('sylius.mailer.sender_name', $config['sender']['name']);
- $container->setParameter('sylius.mailer.sender_address', $config['sender']['address']);
-
- $templates = $config['templates'] ?? ['Default' => 'SyliusMailerBundle::default.html.twig'];
-
- $container->setParameter('sylius.mailer.emails', $config['emails']);
- $container->setParameter('sylius.mailer.templates', $templates);
- }
-}
diff --git a/src/Sylius/Bundle/MailerBundle/LICENSE b/src/Sylius/Bundle/MailerBundle/LICENSE
deleted file mode 100644
index 4b99196c63..0000000000
--- a/src/Sylius/Bundle/MailerBundle/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2011-2018 Paweł Jędrzejewski
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is furnished
-to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/src/Sylius/Bundle/MailerBundle/README.md b/src/Sylius/Bundle/MailerBundle/README.md
deleted file mode 100644
index 04e3c2ad3e..0000000000
--- a/src/Sylius/Bundle/MailerBundle/README.md
+++ /dev/null
@@ -1,52 +0,0 @@
-SyliusMailerBundle [](http://travis-ci.org/Sylius/SyliusMailerBundle)
-==================
-
-[**Symfony2**](http://symfony.com) integration of Sylius Mailer component.
-
-Sylius
-------
-
-**Sylius** - Modern ecommerce for Symfony2. Visit [Sylius.org](http://sylius.com).
-
-Sylius
-------
-
-
-
-Sylius is an Open Source eCommerce solution built from decoupled components with powerful API and the highest quality code. [Read more on sylius.com](http://sylius.com).
-
-Documentation
--------------
-
-Documentation is available on [**docs.sylius.com**](http://docs.sylius.com/en/latest/components_and_bundles/bundles/SyliusMailerBundle/index.html).
-
-Contributing
-------------
-
-[This page](http://docs.sylius.com/en/latest/contributing/index.html) contains all the information about contributing to Sylius.
-
-Follow Sylius' Development
---------------------------
-
-If you want to keep up with the updates and latest features, follow us on the following channels:
-
-* [Official Blog](https://sylius.com/blog)
-* [Sylius on Twitter](https://twitter.com/Sylius)
-* [Sylius on Facebook](https://facebook.com/SyliusEcommerce)
-
-Bug tracking
-------------
-
-Sylius uses [GitHub issues](https://github.com/Sylius/Sylius/issues).
-If you have found bug, please create an issue.
-
-MIT License
------------
-
-License can be found [here](https://github.com/Sylius/Sylius/blob/master/LICENSE).
-
-Authors
--------
-
-The bundle was originally created by [Paweł Jędrzejewski](http://pjedrzejewski.com).
-See the list of [contributors](https://github.com/Sylius/Sylius/contributors).
diff --git a/src/Sylius/Bundle/MailerBundle/Renderer/Adapter/EmailTwigAdapter.php b/src/Sylius/Bundle/MailerBundle/Renderer/Adapter/EmailTwigAdapter.php
deleted file mode 100644
index a4ee5cc2ca..0000000000
--- a/src/Sylius/Bundle/MailerBundle/Renderer/Adapter/EmailTwigAdapter.php
+++ /dev/null
@@ -1,105 +0,0 @@
-twig = $twig;
- }
-
- /**
- * {@inheritdoc}
- */
- public function render(EmailInterface $email, array $data = []): RenderedEmail
- {
- $renderedEmail = $this->getRenderedEmail($email, $data);
-
- /** @var EmailRenderEvent $event */
- $event = $this->dispatcher->dispatch(
- SyliusMailerEvents::EMAIL_PRE_RENDER,
- new EmailRenderEvent($renderedEmail)
- );
-
- return $event->getRenderedEmail();
- }
-
- /**
- * @param EmailInterface $email
- * @param array $data
- *
- * @return RenderedEmail
- */
- private function getRenderedEmail(EmailInterface $email, array $data): RenderedEmail
- {
- if (null !== $email->getTemplate()) {
- return $this->provideEmailWithTemplate($email, $data);
- }
-
- return $this->provideEmailWithoutTemplate($email, $data);
- }
-
- /**
- * @param EmailInterface $email
- * @param array $data
- *
- * @return RenderedEmail
- */
- private function provideEmailWithTemplate(EmailInterface $email, array $data): RenderedEmail
- {
- $data = $this->twig->mergeGlobals($data);
-
- /** @var \Twig_Template $template */
- $template = $this->twig->loadTemplate($email->getTemplate());
-
- $subject = $template->renderBlock('subject', $data);
- $body = $template->renderBlock('body', $data);
-
- return new RenderedEmail($subject, $body);
- }
-
- /**
- * @param EmailInterface $email
- * @param array $data
- *
- * @return RenderedEmail
- */
- private function provideEmailWithoutTemplate(EmailInterface $email, array $data): RenderedEmail
- {
- $twig = new \Twig_Environment(new \Twig_Loader_Array([]));
-
- $subjectTemplate = $twig->createTemplate($email->getSubject());
- $bodyTemplate = $twig->createTemplate($email->getContent());
-
- $subject = $subjectTemplate->render($data);
- $body = $bodyTemplate->render($data);
-
- return new RenderedEmail($subject, $body);
- }
-}
diff --git a/src/Sylius/Bundle/MailerBundle/Resources/config/services.xml b/src/Sylius/Bundle/MailerBundle/Resources/config/services.xml
deleted file mode 100644
index 6a8ec55381..0000000000
--- a/src/Sylius/Bundle/MailerBundle/Resources/config/services.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-
-
-
-
-
-
-
-
- %sylius.mailer.emails%
-
-
-
-
-
-
-
-
-
- %sylius.mailer.sender_name%
- %sylius.mailer.sender_address%
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Sylius/Bundle/MailerBundle/Sender/Adapter/SwiftMailerAdapter.php b/src/Sylius/Bundle/MailerBundle/Sender/Adapter/SwiftMailerAdapter.php
deleted file mode 100644
index 43e867ecb7..0000000000
--- a/src/Sylius/Bundle/MailerBundle/Sender/Adapter/SwiftMailerAdapter.php
+++ /dev/null
@@ -1,72 +0,0 @@
-mailer = $mailer;
- }
-
- /**
- * {@inheritdoc}
- */
- public function send(
- array $recipients,
- string $senderAddress,
- string $senderName,
- RenderedEmail $renderedEmail,
- EmailInterface $email,
- array $data,
- array $attachments = [],
- array $replyTo = []
- ): void {
- $message = (new \Swift_Message())
- ->setSubject($renderedEmail->getSubject())
- ->setFrom([$senderAddress => $senderName])
- ->setTo($recipients)
- ->setReplyTo($replyTo);
-
- $message->setBody($renderedEmail->getBody(), 'text/html');
-
- foreach ($attachments as $attachment) {
- $file = \Swift_Attachment::fromPath($attachment);
-
- $message->attach($file);
- }
-
- $emailSendEvent = new EmailSendEvent($message, $email, $data, $recipients, $replyTo);
-
- $this->dispatcher->dispatch(SyliusMailerEvents::EMAIL_PRE_SEND, $emailSendEvent);
-
- $this->mailer->send($message);
-
- $this->dispatcher->dispatch(SyliusMailerEvents::EMAIL_POST_SEND, $emailSendEvent);
- }
-}
diff --git a/src/Sylius/Bundle/MailerBundle/SyliusMailerBundle.php b/src/Sylius/Bundle/MailerBundle/SyliusMailerBundle.php
deleted file mode 100644
index d126bc84fb..0000000000
--- a/src/Sylius/Bundle/MailerBundle/SyliusMailerBundle.php
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-
- ./test/
-
-
-
diff --git a/src/Sylius/Bundle/MailerBundle/spec/Renderer/Adapter/EmailTwigAdapterSpec.php b/src/Sylius/Bundle/MailerBundle/spec/Renderer/Adapter/EmailTwigAdapterSpec.php
deleted file mode 100644
index 731c3c44ca..0000000000
--- a/src/Sylius/Bundle/MailerBundle/spec/Renderer/Adapter/EmailTwigAdapterSpec.php
+++ /dev/null
@@ -1,86 +0,0 @@
-beConstructedWith($twig);
- }
-
- function it_is_an_adapter(): void
- {
- $this->shouldHaveType(AbstractAdapter::class);
- }
-
- function it_renders_an_email(
- \Twig_Environment $twig,
- \Twig_Template $template,
- EmailInterface $email,
- EmailRenderEvent $event,
- EventDispatcherInterface $dispatcher,
- RenderedEmail $renderedEmail
- ): void {
- $this->setEventDispatcher($dispatcher);
-
- $twig->mergeGlobals([])->shouldBeCalled()->willReturn([]);
-
- $email->getTemplate()->shouldBeCalled()->willReturn('MyTemplate');
- $twig->loadTemplate('MyTemplate')->shouldBeCalled()->willReturn($template);
-
- $template->renderBlock('subject', [])->willReturn('template');
- $template->renderBlock('body', [])->willReturn('body');
-
- $dispatcher->dispatch(
- SyliusMailerEvents::EMAIL_PRE_RENDER,
- Argument::type(EmailRenderEvent::class)
- )->shouldBeCalled()->willReturn($event);
-
- $event->getRenderedEmail()->shouldBeCalled()->willReturn($renderedEmail);
-
- $this->render($email, [])->shouldReturn($renderedEmail);
- }
-
- function it_creates_and_renders_an_email(
- EmailInterface $email,
- EmailRenderEvent $event,
- EventDispatcherInterface $dispatcher,
- RenderedEmail $renderedEmail
- ): void {
- $this->setEventDispatcher($dispatcher);
-
- $email->getTemplate()->shouldBeCalled()->willReturn(null);
- $email->getSubject()->shouldBeCalled()->willReturn('subject');
- $email->getContent()->shouldBeCalled()->willReturn('content');
-
- $dispatcher->dispatch(
- SyliusMailerEvents::EMAIL_PRE_RENDER,
- Argument::type(EmailRenderEvent::class)
- )->shouldBeCalled()->willReturn($event);
-
- $event->getRenderedEmail()->shouldBeCalled()->willReturn($renderedEmail);
-
- $this->render($email, [])->shouldReturn($renderedEmail);
- }
-}
diff --git a/src/Sylius/Bundle/MailerBundle/spec/Sender/Adapter/SwiftMailerAdapterSpec.php b/src/Sylius/Bundle/MailerBundle/spec/Sender/Adapter/SwiftMailerAdapterSpec.php
deleted file mode 100644
index f8b5ac5f3a..0000000000
--- a/src/Sylius/Bundle/MailerBundle/spec/Sender/Adapter/SwiftMailerAdapterSpec.php
+++ /dev/null
@@ -1,69 +0,0 @@
-beConstructedWith($mailer);
- }
-
- function it_is_an_adapter(): void
- {
- $this->shouldHaveType(AbstractAdapter::class);
- }
-
- function it_sends_an_email(
- \Swift_Mailer $mailer,
- EmailInterface $email,
- EventDispatcherInterface $dispatcher,
- RenderedEmail $renderedEmail
- ): void {
- $this->setEventDispatcher($dispatcher);
-
- $renderedEmail->getSubject()->shouldBeCalled()->willReturn('subject');
- $renderedEmail->getBody()->shouldBeCalled()->willReturn('body');
-
- $dispatcher->dispatch(
- SyliusMailerEvents::EMAIL_PRE_SEND,
- Argument::type(EmailSendEvent::class)
- )->shouldBeCalled();
-
- $mailer->send(Argument::type('\Swift_Message'))->shouldBeCalled();
-
- $dispatcher->dispatch(
- SyliusMailerEvents::EMAIL_POST_SEND,
- Argument::type(EmailSendEvent::class)
- )->shouldBeCalled();
-
- $this->send(
- ['pawel@sylius.com'],
- 'arnaud@sylius.com',
- 'arnaud',
- $renderedEmail,
- $email,
- []
- );
- }
-}
diff --git a/src/Sylius/Bundle/MailerBundle/test/app/AppKernel.php b/src/Sylius/Bundle/MailerBundle/test/app/AppKernel.php
deleted file mode 100644
index c2784f2c46..0000000000
--- a/src/Sylius/Bundle/MailerBundle/test/app/AppKernel.php
+++ /dev/null
@@ -1,52 +0,0 @@
-load(__DIR__ . '/config/config.yml');
- }
-
- /**
- * {@inheritdoc}
- */
- protected function getContainerBaseClass(): string
- {
- if ('test' === $this->environment) {
- return MockerContainer::class;
- }
-
- return parent::getContainerBaseClass();
- }
-}
diff --git a/src/Sylius/Bundle/MailerBundle/test/app/config/config.yml b/src/Sylius/Bundle/MailerBundle/test/app/config/config.yml
deleted file mode 100644
index bbf259f956..0000000000
--- a/src/Sylius/Bundle/MailerBundle/test/app/config/config.yml
+++ /dev/null
@@ -1,15 +0,0 @@
-imports:
- - { resource: "@SyliusMailerBundle/test/app/config/parameters.yml" }
-
-framework:
- assets: false
- secret: "%secret%"
- templating:
- engines: ['twig']
- default_locale: "%locale%"
- http_method_override: true
- test: ~
-
-twig:
- debug: "%kernel.debug%"
- strict_variables: "%kernel.debug%"
diff --git a/src/Sylius/Bundle/MailerBundle/test/app/config/parameters.yml b/src/Sylius/Bundle/MailerBundle/test/app/config/parameters.yml
deleted file mode 100644
index edb7b6d684..0000000000
--- a/src/Sylius/Bundle/MailerBundle/test/app/config/parameters.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-parameters:
- locale: en_US
- secret: "Three can keep a secret, if two of them are dead."
diff --git a/src/Sylius/Bundle/MailerBundle/test/app/console b/src/Sylius/Bundle/MailerBundle/test/app/console
deleted file mode 100755
index 296012b2bf..0000000000
--- a/src/Sylius/Bundle/MailerBundle/test/app/console
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env php
-run($input);
diff --git a/src/Sylius/Bundle/MailerBundle/test/src/Tests/SyliusMailerBundleTest.php b/src/Sylius/Bundle/MailerBundle/test/src/Tests/SyliusMailerBundleTest.php
deleted file mode 100644
index 0dac63ceb8..0000000000
--- a/src/Sylius/Bundle/MailerBundle/test/src/Tests/SyliusMailerBundleTest.php
+++ /dev/null
@@ -1,39 +0,0 @@
-getContainer();
-
- $services = $container->getServiceIds();
-
- $services = array_filter($services, function ($serviceId) {
- return 0 === strpos($serviceId, 'sylius.');
- });
-
- foreach ($services as $id) {
- $container->get($id);
- }
- }
-}
diff --git a/src/Sylius/Component/Mailer/.gitignore b/src/Sylius/Component/Mailer/.gitignore
deleted file mode 100644
index 46aed33710..0000000000
--- a/src/Sylius/Component/Mailer/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-vendor/
-bin/
-
-composer.phar
-composer.lock
diff --git a/src/Sylius/Component/Mailer/Event/EmailRenderEvent.php b/src/Sylius/Component/Mailer/Event/EmailRenderEvent.php
deleted file mode 100644
index 6d96ac304f..0000000000
--- a/src/Sylius/Component/Mailer/Event/EmailRenderEvent.php
+++ /dev/null
@@ -1,72 +0,0 @@
-renderedEmail = $renderedEmail;
- $this->recipients = $recipients;
- }
-
- /**
- * @return RenderedEmail
- */
- public function getRenderedEmail(): RenderedEmail
- {
- return $this->renderedEmail;
- }
-
- /**
- * @param RenderedEmail $renderedEmail
- */
- public function setRenderedEmail(RenderedEmail $renderedEmail): void
- {
- $this->renderedEmail = $renderedEmail;
- }
-
- /**
- * @return array
- */
- public function getRecipients(): array
- {
- return $this->recipients;
- }
-
- /**
- * @param array $recipients
- */
- public function setRecipients(array $recipients): void
- {
- $this->recipients = $recipients;
- }
-}
diff --git a/src/Sylius/Component/Mailer/Event/EmailSendEvent.php b/src/Sylius/Component/Mailer/Event/EmailSendEvent.php
deleted file mode 100644
index 7cd92dda15..0000000000
--- a/src/Sylius/Component/Mailer/Event/EmailSendEvent.php
+++ /dev/null
@@ -1,100 +0,0 @@
-message = $message;
- $this->email = $email;
- $this->data = $data;
- $this->recipients = $recipients;
- $this->replyTo = $replyTo;
- }
-
- /**
- * @return array
- */
- public function getRecipients(): array
- {
- return $this->recipients;
- }
-
- /**
- * @return EmailInterface
- */
- public function getEmail(): EmailInterface
- {
- return $this->email;
- }
-
- /**
- * @return mixed
- */
- public function getMessage()
- {
- return $this->message;
- }
-
- /**
- * @return array
- */
- public function getData(): array
- {
- return $this->data;
- }
-
- /**
- * @return string[]
- */
- public function getReplyTo(): array
- {
- return $this->replyTo;
- }
-}
diff --git a/src/Sylius/Component/Mailer/Factory/EmailFactory.php b/src/Sylius/Component/Mailer/Factory/EmailFactory.php
deleted file mode 100644
index 50bee8bd44..0000000000
--- a/src/Sylius/Component/Mailer/Factory/EmailFactory.php
+++ /dev/null
@@ -1,28 +0,0 @@
-id;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getCode(): ?string
- {
- return $this->code;
- }
-
- /**
- * {@inheritdoc}
- */
- public function setCode(string $code): void
- {
- $this->code = $code;
- }
-
- /**
- * {@inheritdoc}
- */
- public function isEnabled(): bool
- {
- return $this->enabled;
- }
-
- /**
- * @param bool $enabled
- */
- public function setEnabled(bool $enabled): void
- {
- $this->enabled = $enabled;
- }
-
- public function enable(): void
- {
- $this->enabled = true;
- }
-
- public function disable(): void
- {
- $this->enabled = false;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getSubject(): ?string
- {
- return $this->subject;
- }
-
- /**
- * {@inheritdoc}
- */
- public function setSubject(string $subject): void
- {
- $this->subject = $subject;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getContent(): ?string
- {
- return $this->content;
- }
-
- /**
- * {@inheritdoc}
- */
- public function setContent(string $content): void
- {
- $this->content = $content;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getTemplate(): ?string
- {
- return $this->template;
- }
-
- /**
- * {@inheritdoc}
- */
- public function setTemplate(string $template): void
- {
- $this->template = $template;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getSenderName(): ?string
- {
- return $this->senderName;
- }
-
- /**
- * {@inheritdoc}
- */
- public function setSenderName(string $senderName): void
- {
- $this->senderName = $senderName;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getSenderAddress(): ?string
- {
- return $this->senderAddress;
- }
-
- /**
- * {@inheritdoc}
- */
- public function setSenderAddress(string $senderAddress): void
- {
- $this->senderAddress = $senderAddress;
- }
-}
diff --git a/src/Sylius/Component/Mailer/Model/EmailInterface.php b/src/Sylius/Component/Mailer/Model/EmailInterface.php
deleted file mode 100644
index c4ad7913ff..0000000000
--- a/src/Sylius/Component/Mailer/Model/EmailInterface.php
+++ /dev/null
@@ -1,91 +0,0 @@
-senderName = $senderName;
- $this->senderAddress = $senderAddress;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getSenderName(): string
- {
- return $this->senderName;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getSenderAddress(): string
- {
- return $this->senderAddress;
- }
-}
diff --git a/src/Sylius/Component/Mailer/Provider/DefaultSettingsProviderInterface.php b/src/Sylius/Component/Mailer/Provider/DefaultSettingsProviderInterface.php
deleted file mode 100644
index dea30c199e..0000000000
--- a/src/Sylius/Component/Mailer/Provider/DefaultSettingsProviderInterface.php
+++ /dev/null
@@ -1,27 +0,0 @@
-emailFactory = $emailFactory;
- $this->configuration = $configuration;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getEmail(string $code): EmailInterface
- {
- return $this->getEmailFromConfiguration($code);
- }
-
- /**
- * @param string $code
- *
- * @return EmailInterface
- */
- private function getEmailFromConfiguration(string $code): EmailInterface
- {
- Assert::keyExists($this->configuration, $code, sprintf('Email with code "%s" does not exist!', $code));
-
- /** @var EmailInterface $email */
- $email = $this->emailFactory->createNew();
- $configuration = $this->configuration[$code];
-
- $email->setCode($code);
- $email->setSubject($configuration['subject']);
- $email->setTemplate($configuration['template']);
-
- if (isset($configuration['enabled']) && false === $configuration['enabled']) {
- $email->setEnabled(false);
- }
- if (isset($configuration['sender']['name'])) {
- $email->setSenderName($configuration['sender']['name']);
- }
- if (isset($configuration['sender']['address'])) {
- $email->setSenderAddress($configuration['sender']['address']);
- }
-
- return $email;
- }
-}
diff --git a/src/Sylius/Component/Mailer/Provider/EmailProviderInterface.php b/src/Sylius/Component/Mailer/Provider/EmailProviderInterface.php
deleted file mode 100644
index 1763a9a2ff..0000000000
--- a/src/Sylius/Component/Mailer/Provider/EmailProviderInterface.php
+++ /dev/null
@@ -1,26 +0,0 @@
-dispatcher = $dispatcher;
- }
-}
diff --git a/src/Sylius/Component/Mailer/Renderer/Adapter/AdapterInterface.php b/src/Sylius/Component/Mailer/Renderer/Adapter/AdapterInterface.php
deleted file mode 100644
index 19ec8a4939..0000000000
--- a/src/Sylius/Component/Mailer/Renderer/Adapter/AdapterInterface.php
+++ /dev/null
@@ -1,28 +0,0 @@
-subject = $subject;
- $this->body = $body;
- }
-
- /**
- * @return string
- */
- public function getSubject(): string
- {
- return $this->subject;
- }
-
- /**
- * @param string $subject
- */
- public function setSubject(string $subject): void
- {
- $this->subject = $subject;
- }
-
- /**
- * @return string
- */
- public function getBody(): string
- {
- return $this->body;
- }
-
- /**
- * @param string $body
- */
- public function setBody(string $body): void
- {
- $this->body = $body;
- }
-}
diff --git a/src/Sylius/Component/Mailer/Sender/Adapter/AbstractAdapter.php b/src/Sylius/Component/Mailer/Sender/Adapter/AbstractAdapter.php
deleted file mode 100644
index 278320f5cd..0000000000
--- a/src/Sylius/Component/Mailer/Sender/Adapter/AbstractAdapter.php
+++ /dev/null
@@ -1,32 +0,0 @@
-dispatcher = $dispatcher;
- }
-}
diff --git a/src/Sylius/Component/Mailer/Sender/Adapter/AdapterInterface.php b/src/Sylius/Component/Mailer/Sender/Adapter/AdapterInterface.php
deleted file mode 100644
index 65f1b52aa8..0000000000
--- a/src/Sylius/Component/Mailer/Sender/Adapter/AdapterInterface.php
+++ /dev/null
@@ -1,41 +0,0 @@
-senderAdapter = $senderAdapter;
- $this->rendererAdapter = $rendererAdapter;
- $this->provider = $provider;
- $this->defaultSettingsProvider = $defaultSettingsProvider;
- }
-
- /**
- * {@inheritdoc}
- */
- public function send(string $code, array $recipients, array $data = [], array $attachments = [], array $replyTo = []): void
- {
- $email = $this->provider->getEmail($code);
-
- if (!$email->isEnabled()) {
- return;
- }
-
- $senderAddress = $email->getSenderAddress() ?: $this->defaultSettingsProvider->getSenderAddress();
- $senderName = $email->getSenderName() ?: $this->defaultSettingsProvider->getSenderName();
-
- $renderedEmail = $this->rendererAdapter->render($email, $data);
-
- $this->senderAdapter->send(
- $recipients,
- $senderAddress,
- $senderName,
- $renderedEmail,
- $email,
- $data,
- $attachments,
- $replyTo
- );
- }
-}
diff --git a/src/Sylius/Component/Mailer/Sender/SenderInterface.php b/src/Sylius/Component/Mailer/Sender/SenderInterface.php
deleted file mode 100644
index f6a5685fc9..0000000000
--- a/src/Sylius/Component/Mailer/Sender/SenderInterface.php
+++ /dev/null
@@ -1,26 +0,0 @@
-shouldImplement(EmailFactoryInterface::class);
- }
-
- function it_creates_new_email(): void
- {
- $this->createNew()->shouldHaveType(Email::class);
- }
-}
diff --git a/src/Sylius/Component/Mailer/spec/Model/EmailSpec.php b/src/Sylius/Component/Mailer/spec/Model/EmailSpec.php
deleted file mode 100644
index 1d86826f8e..0000000000
--- a/src/Sylius/Component/Mailer/spec/Model/EmailSpec.php
+++ /dev/null
@@ -1,77 +0,0 @@
-shouldImplement(EmailInterface::class);
- }
-
- function it_has_no_code_by_default(): void
- {
- $this->getCode()->shouldReturn(null);
- }
-
- function its_code_is_mutable(): void
- {
- $this->setCode('bar');
- $this->getCode()->shouldReturn('bar');
- }
-
- function its_subject_is_mutable(): void
- {
- $this->setSubject('foo');
- $this->getSubject()->shouldReturn('foo');
- }
-
- function its_content_is_mutable(): void
- {
- $this->setContent('foo content');
- $this->getContent()->shouldReturn('foo content');
- }
-
- function its_template_is_mutable(): void
- {
- $this->setContent('template.html.twig');
- $this->getContent()->shouldReturn('template.html.twig');
- }
-
- function its_sender_name_is_mutable(): void
- {
- $this->setSenderName('Example');
- $this->getSenderName()->shouldReturn('Example');
- }
-
- function its_sender_address_is_mutable(): void
- {
- $this->setSenderAddress('no-reply@example.com');
- $this->getSenderAddress()->shouldReturn('no-reply@example.com');
- }
-
- function it_is_enabled_by_default(): void
- {
- $this->shouldBeEnabled();
- }
-
- function it_can_be_disabled(): void
- {
- $this->setEnabled(false);
- $this->shouldNotBeEnabled();
- }
-}
diff --git a/src/Sylius/Component/Mailer/spec/Provider/EmailProviderSpec.php b/src/Sylius/Component/Mailer/spec/Provider/EmailProviderSpec.php
deleted file mode 100644
index 578d334a16..0000000000
--- a/src/Sylius/Component/Mailer/spec/Provider/EmailProviderSpec.php
+++ /dev/null
@@ -1,69 +0,0 @@
- [
- 'enabled' => false,
- 'subject' => 'Hello test!',
- 'template' => 'SyliusMailerBundle::default.html.twig',
- 'sender' => [
- 'name' => 'John Doe',
- 'address' => 'john@doe.com',
- ],
- ],
- 'order_cancelled' => [
- 'enabled' => false,
- 'subject' => 'Hi test!',
- 'template' => 'SyliusMailerBundle::default.html.twig',
- 'sender' => [
- 'name' => 'Rick Doe',
- 'address' => 'john@doe.com',
- ],
- ],
- ];
-
- $this->beConstructedWith($emailFactory, $emails);
- }
-
- function it_implements_email_provider_interface(): void
- {
- $this->shouldImplement(EmailProviderInterface::class);
- }
-
- function it_looks_for_an_email_in_configuration_when_it_cannot_be_found_via_repository(
- EmailInterface $email,
- EmailFactoryInterface $emailFactory
- ): void {
- $emailFactory->createNew()->willReturn($email);
-
- $email->setCode('user_confirmation')->shouldBeCalled();
- $email->setSubject('Hello test!')->shouldBeCalled();
- $email->setTemplate('SyliusMailerBundle::default.html.twig')->shouldBeCalled();
- $email->setSenderName('John Doe')->shouldBeCalled();
- $email->setSenderAddress('john@doe.com')->shouldBeCalled();
- $email->setEnabled(false)->shouldBeCalled();
-
- $this->getEmail('user_confirmation')->shouldReturn($email);
- }
-}
diff --git a/src/Sylius/Component/Mailer/spec/Sender/SenderSpec.php b/src/Sylius/Component/Mailer/spec/Sender/SenderSpec.php
deleted file mode 100644
index e5938fe550..0000000000
--- a/src/Sylius/Component/Mailer/spec/Sender/SenderSpec.php
+++ /dev/null
@@ -1,69 +0,0 @@
-beConstructedWith($rendererAdapter, $senderAdapter, $provider, $defaultSettingsProvider);
- }
-
- function it_sends_an_email_through_the_adapter(
- EmailInterface $email,
- EmailProviderInterface $provider,
- RenderedEmail $renderedEmail,
- RendererAdapterInterface $rendererAdapter,
- SenderAdapterInterface $senderAdapter
- ): void {
- $provider->getEmail('bar')->willReturn($email);
- $email->isEnabled()->willReturn(true);
- $email->getSenderAddress()->willReturn('sender@example.com');
- $email->getSenderName()->willReturn('Sender');
-
- $data = ['foo' => 2];
-
- $rendererAdapter->render($email, ['foo' => 2])->willReturn($renderedEmail);
- $senderAdapter->send(['john@example.com'], 'sender@example.com', 'Sender', $renderedEmail, $email, $data, [], [])->shouldBeCalled();
-
- $this->send('bar', ['john@example.com'], $data, []);
- }
-
- function it_does_not_send_disabled_emails(
- EmailInterface $email,
- EmailProviderInterface $provider,
- RendererAdapterInterface $rendererAdapter,
- SenderAdapterInterface $senderAdapter
- ): void {
- $provider->getEmail('bar')->willReturn($email);
- $email->isEnabled()->willReturn(false);
-
- $rendererAdapter->render($email, ['foo' => 2])->shouldNotBeCalled();
- $senderAdapter->send(['john@example.com'], 'mail@sylius.com', 'Sylius Mailer', null, $email, [], [], [])->shouldNotBeCalled();
-
- $this->send('bar', ['john@example.com'], ['foo' => 2], []);
- }
-}