Skip to content

Commit

Permalink
Merge pull request #31 from BitBagCommerce/fix/op-465-fix-missing-int…
Browse files Browse the repository at this point in the history
…erfaces

OP-465/Change exact factory classes to interfaces
  • Loading branch information
senghe authored Aug 1, 2024
2 parents ba16ad7 + 2edeab7 commit e87c364
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,19 @@
namespace BitBag\SyliusMailTemplatePlugin\MailPreviewData;

use BitBag\SyliusMailTemplatePlugin\MailPreviewData\Factory\PreviewDataFactoryInterface;
use Sylius\Bundle\CoreBundle\Fixture\Factory\ChannelExampleFactory;
use Sylius\Bundle\CoreBundle\Fixture\Factory\ExampleFactoryInterface;
use Sylius\Component\Core\Model\ChannelInterface;
use Sylius\Component\Locale\Model\LocaleInterface;

final class AccountVerificationTokenMailPreviewData implements MailPreviewDataInterface
{
public const INDEX = 'account_verification_token';

private ChannelExampleFactory $channelExampleFactory;
private ExampleFactoryInterface $channelExampleFactory;

private PreviewDataFactoryInterface $customerPreviewDataFactory;

public function __construct(ChannelExampleFactory $channelExampleFactory, PreviewDataFactoryInterface $customerPreviewDataFactory)
public function __construct(ExampleFactoryInterface $channelExampleFactory, PreviewDataFactoryInterface $customerPreviewDataFactory)
{
$this->channelExampleFactory = $channelExampleFactory;
$this->customerPreviewDataFactory = $customerPreviewDataFactory;
Expand All @@ -32,6 +33,7 @@ public function __construct(ChannelExampleFactory $channelExampleFactory, Previe
public function getData(): array
{
$customer = $this->customerPreviewDataFactory->create();
/** @var ChannelInterface $channel */
$channel = $this->channelExampleFactory->create();
/** @var LocaleInterface $defaultLocale */
$defaultLocale = $channel->getDefaultLocale();
Expand Down
8 changes: 5 additions & 3 deletions src/MailPreviewData/ContactRequestMailPreviewData.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
namespace BitBag\SyliusMailTemplatePlugin\MailPreviewData;

use BitBag\SyliusMailTemplatePlugin\MailPreviewData\Factory\PreviewDataFactoryInterface;
use Sylius\Bundle\CoreBundle\Fixture\Factory\ChannelExampleFactory;
use Sylius\Bundle\CoreBundle\Fixture\Factory\ExampleFactoryInterface;
use Sylius\Bundle\CoreBundle\Mailer\Emails;
use Sylius\Component\Core\Model\ChannelInterface;
use Sylius\Component\Core\Model\CustomerInterface;
use Sylius\Component\Locale\Model\LocaleInterface;

Expand All @@ -25,11 +26,11 @@ final class ContactRequestMailPreviewData implements MailPreviewDataInterface

public const MESSAGE_FROM_CUSTOMER = '<MESSAGE_FROM_CUSTOMER>';

private ChannelExampleFactory $channelExampleFactory;
private ExampleFactoryInterface $channelExampleFactory;

private PreviewDataFactoryInterface $customerPreviewDataFactory;

public function __construct(ChannelExampleFactory $channelExampleFactory, PreviewDataFactoryInterface $customerPreviewDataFactory)
public function __construct(ExampleFactoryInterface $channelExampleFactory, PreviewDataFactoryInterface $customerPreviewDataFactory)
{
$this->channelExampleFactory = $channelExampleFactory;
$this->customerPreviewDataFactory = $customerPreviewDataFactory;
Expand All @@ -39,6 +40,7 @@ public function getData(): array
{
/** @var CustomerInterface $customer */
$customer = $this->customerPreviewDataFactory->create();
/** @var ChannelInterface $channel */
$channel = $this->channelExampleFactory->create();
/** @var LocaleInterface $defaultLocale */
$defaultLocale = $channel->getDefaultLocale();
Expand Down
8 changes: 5 additions & 3 deletions src/MailPreviewData/OrderConfirmationMailPreviewData.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@
namespace BitBag\SyliusMailTemplatePlugin\MailPreviewData;

use BitBag\SyliusMailTemplatePlugin\MailPreviewData\Factory\PreviewDataFactoryInterface;
use Sylius\Bundle\CoreBundle\Fixture\Factory\OrderExampleFactory;
use Sylius\Bundle\CoreBundle\Fixture\Factory\ExampleFactoryInterface;
use Sylius\Bundle\CoreBundle\Mailer\Emails;
use Sylius\Component\Core\Model\OrderInterface;

final class OrderConfirmationMailPreviewData implements MailPreviewDataInterface
{
private OrderExampleFactory $orderExampleFactory;
private ExampleFactoryInterface $orderExampleFactory;

private PreviewDataFactoryInterface $customerPreviewDataFactory;

public function __construct(OrderExampleFactory $orderExampleFactory, PreviewDataFactoryInterface $customerPreviewDataFactory)
public function __construct(ExampleFactoryInterface $orderExampleFactory, PreviewDataFactoryInterface $customerPreviewDataFactory)
{
$this->orderExampleFactory = $orderExampleFactory;
$this->customerPreviewDataFactory = $customerPreviewDataFactory;
Expand All @@ -30,6 +31,7 @@ public function __construct(OrderExampleFactory $orderExampleFactory, PreviewDat
public function getData(): array
{
$customer = $this->customerPreviewDataFactory->create();
/** @var OrderInterface $order */
$order = $this->orderExampleFactory->create([
MailPreviewDataInterface::CUSTOMER_KEY => $customer,
]);
Expand Down
8 changes: 5 additions & 3 deletions src/MailPreviewData/PasswordResetMailPreviewData.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,19 @@
namespace BitBag\SyliusMailTemplatePlugin\MailPreviewData;

use BitBag\SyliusMailTemplatePlugin\MailPreviewData\Factory\PreviewDataFactoryInterface;
use Sylius\Bundle\CoreBundle\Fixture\Factory\ChannelExampleFactory;
use Sylius\Bundle\CoreBundle\Fixture\Factory\ExampleFactoryInterface;
use Sylius\Component\Core\Model\ChannelInterface;
use Sylius\Component\Locale\Model\LocaleInterface;

final class PasswordResetMailPreviewData implements MailPreviewDataInterface
{
public const INDEX = 'password_reset';

private ChannelExampleFactory $channelExampleFactory;
private ExampleFactoryInterface $channelExampleFactory;

private PreviewDataFactoryInterface $customerPreviewDataFactory;

public function __construct(ChannelExampleFactory $channelExampleFactory, PreviewDataFactoryInterface $customerPreviewDataFactory)
public function __construct(ExampleFactoryInterface $channelExampleFactory, PreviewDataFactoryInterface $customerPreviewDataFactory)
{
$this->channelExampleFactory = $channelExampleFactory;
$this->customerPreviewDataFactory = $customerPreviewDataFactory;
Expand All @@ -32,6 +33,7 @@ public function __construct(ChannelExampleFactory $channelExampleFactory, Previe
public function getData(): array
{
$user = $this->customerPreviewDataFactory->create();
/** @var ChannelInterface $channel */
$channel = $this->channelExampleFactory->create();
/** @var LocaleInterface $defaultLocale */
$defaultLocale = $channel->getDefaultLocale();
Expand Down
8 changes: 5 additions & 3 deletions src/MailPreviewData/ShipmentConfirmationMailPreviewData.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@
namespace BitBag\SyliusMailTemplatePlugin\MailPreviewData;

use BitBag\SyliusMailTemplatePlugin\MailPreviewData\Factory\PreviewDataFactoryInterface;
use Sylius\Bundle\CoreBundle\Fixture\Factory\OrderExampleFactory;
use Sylius\Bundle\CoreBundle\Fixture\Factory\ExampleFactoryInterface;
use Sylius\Bundle\CoreBundle\Mailer\Emails;
use Sylius\Component\Core\Model\OrderInterface;

final class ShipmentConfirmationMailPreviewData implements MailPreviewDataInterface
{
private OrderExampleFactory $orderExampleFactory;
private ExampleFactoryInterface $orderExampleFactory;

private PreviewDataFactoryInterface $customerPreviewDataFactory;

public function __construct(OrderExampleFactory $orderExampleFactory, PreviewDataFactoryInterface $customerPreviewDataFactory)
public function __construct(ExampleFactoryInterface $orderExampleFactory, PreviewDataFactoryInterface $customerPreviewDataFactory)
{
$this->orderExampleFactory = $orderExampleFactory;
$this->customerPreviewDataFactory = $customerPreviewDataFactory;
Expand All @@ -30,6 +31,7 @@ public function __construct(OrderExampleFactory $orderExampleFactory, PreviewDat
public function getData(): array
{
$customer = $this->customerPreviewDataFactory->create();
/** @var OrderInterface $order */
$order = $this->orderExampleFactory->create([
MailPreviewDataInterface::CUSTOMER_KEY => $customer,
]);
Expand Down
8 changes: 5 additions & 3 deletions src/MailPreviewData/UserRegistrationMailPreviewData.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@
namespace BitBag\SyliusMailTemplatePlugin\MailPreviewData;

use BitBag\SyliusMailTemplatePlugin\MailPreviewData\Factory\PreviewDataFactoryInterface;
use Sylius\Bundle\CoreBundle\Fixture\Factory\ChannelExampleFactory;
use Sylius\Bundle\CoreBundle\Fixture\Factory\ExampleFactoryInterface;
use Sylius\Bundle\CoreBundle\Mailer\Emails;
use Sylius\Component\Core\Model\ChannelInterface;
use Sylius\Component\Locale\Model\LocaleInterface;

final class UserRegistrationMailPreviewData implements MailPreviewDataInterface
{
private ChannelExampleFactory $channelExampleFactory;
private ExampleFactoryInterface $channelExampleFactory;

private PreviewDataFactoryInterface $customerPreviewDataFactory;

public function __construct(ChannelExampleFactory $channelExampleFactory, PreviewDataFactoryInterface $customerPreviewDataFactory)
public function __construct(ExampleFactoryInterface $channelExampleFactory, PreviewDataFactoryInterface $customerPreviewDataFactory)
{
$this->channelExampleFactory = $channelExampleFactory;
$this->customerPreviewDataFactory = $customerPreviewDataFactory;
Expand All @@ -31,6 +32,7 @@ public function __construct(ChannelExampleFactory $channelExampleFactory, Previe
public function getData(): array
{
$user = $this->customerPreviewDataFactory->create();
/** @var ChannelInterface $channel */
$channel = $this->channelExampleFactory->create();
/** @var LocaleInterface $defaultLocale */
$defaultLocale = $channel->getDefaultLocale();
Expand Down

0 comments on commit e87c364

Please sign in to comment.