MailUpdate example

// update TRANSACTION_STATE_PAID_PARTIALLY         $this->updateMailTemplatesByType(MailTemplateTypes::MAILTYPE_STATE_ENTER_ORDER_TRANSACTION_STATE_PAID_PARTIALLY, $connection);
    }

    public function updateDestructive(Connection $connection): void
    {
        // implement update destructive     }

    private function updateMailTemplatesByType(string $type, Connection $connection): void
    {
        $update = new MailUpdate(
            $type,
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/' . $type . '/en-plain.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/' . $type . '/en-html.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/' . $type . '/de-plain.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/' . $type . '/de-html.html.twig')
        );

        $this->updateMail($update$connection);
    }
}
class Migration1660814397UpdateOrderCancelledMailTemplate extends MigrationStep
{
    use UpdateMailTrait;

    public function getCreationTimestamp(): int
    {
        return 1660814397;
    }

    public function update(Connection $connection): void
    {
        $update = new MailUpdate(
            MailTemplateTypes::MAILTYPE_STATE_ENTER_ORDER_STATE_CANCELLED,
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/order.state.cancelled/en-plain.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/order.state.cancelled/en-html.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/order.state.cancelled/de-plain.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/order.state.cancelled/de-html.html.twig')
        );

        $this->updateMail($update$connection);
    }

    public function updateDestructive(Connection $connection): void
    {
class Migration1630485317UpdateContactFormMailTemplates extends MigrationStep
{
    use UpdateMailTrait;

    public function getCreationTimestamp(): int
    {
        return 1630485317;
    }

    public function update(Connection $connection): void
    {
        $update = new MailUpdate(
            'contact_form',
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/contact_form/en-plain.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/contact_form/en-html.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/contact_form/de-plain.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/contact_form/de-html.html.twig')
        );

        $this->updateMail($update$connection);
    }

    public function updateDestructive(Connection $connection): void
    {
class Migration1692254551FixMailTranslation extends MigrationStep
{
    use UpdateMailTrait;

    public function getCreationTimestamp(): int
    {
        return 1692254551;
    }

    public function update(Connection $connection): void
    {
        $updateAuthorizedMail = new MailUpdate(
            MailTemplateTypes::MAILTYPE_STATE_ENTER_ORDER_TRANSACTION_STATE_AUTHORIZED,
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/order_transaction.state.authorized/en-plain.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/order_transaction.state.authorized/en-html.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/order_transaction.state.authorized/de-plain.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/order_transaction.state.authorized/de-html.html.twig'),
        );
        $this->updateMail($updateAuthorizedMail$connection);

        $updateChargebackMail = new MailUpdate(
            MailTemplateTypes::MAILTYPE_STATE_ENTER_ORDER_TRANSACTION_STATE_CHARGEBACK,
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/order_transaction.state.chargeback/en-plain.html.twig'),
            
'language_id' => $germanLanguageId,
                ]
            );
        }
    }

    /** * @param array<string, mixed> $mail */
    private function updateMailTemplateContent(string $typeName, array $mail, Connection $connection): void
    {
        $update = new MailUpdate(
            $typeName,
            $mail['template']['plainEn'],
            $mail['template']['htmlEn'],
            $mail['template']['plainDe'],
            $mail['template']['htmlEn'],
        );

        $this->updateMail($update$connection);
    }
}
$this->updateMailTemplateContent($connection);
        $this->updateExistingMailTemplateContent($connection);
    }

    public function updateDestructive(Connection $connection): void
    {
        // nth     }

    private function updateMailTemplateContent(Connection $connection): void
    {
        $update = new MailUpdate(
            MailTemplateTypes::MAILTYPE_DOWNLOADS_DELIVERY,
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/downloads_delivery/en-plain.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/downloads_delivery/en-html.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/downloads_delivery/de-plain.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/downloads_delivery/de-html.html.twig')
        );

        $this->updateMail($update$connection);
    }

    private function updateExistingMailTemplateContent(Connection $connection): void
    {
class Migration1636014089UpdateOrderConfirmationMailTemplates extends MigrationStep
{
    use UpdateMailTrait;

    public function getCreationTimestamp(): int
    {
        return 1636014089;
    }

    public function update(Connection $connection): void
    {
        $update = new MailUpdate(
            'order_confirmation_mail',
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/order_confirmation_mail/en-plain.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/order_confirmation_mail/en-html.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/order_confirmation_mail/de-plain.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/order_confirmation_mail/de-html.html.twig'),
        );

        $this->updateMail($update$connection);
    }

    public function updateDestructive(Connection $connection): void
    {
class Migration1604585230UpdateOrderMailsForCashRounding extends MigrationStep
{
    use UpdateMailTrait;

    public function getCreationTimestamp(): int
    {
        return 1604585230;
    }

    public function update(Connection $connection): void
    {
        $update = new MailUpdate(
            MailTemplateTypes::MAILTYPE_ORDER_CONFIRM,
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/order_confirmation_mail/en-plain.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/order_confirmation_mail/en-html.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/order_confirmation_mail/de-plain.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/order_confirmation_mail/de-html.html.twig')
        );

        $this->updateMail($update$connection);

        $update = new MailUpdate(
            MailTemplateTypes::MAILTYPE_STATE_ENTER_ORDER_TRANSACTION_STATE_CANCELLED,
            
class Migration1672164687FixTypoInUserRecoveryPasswordResetMail extends MigrationStep
{
    use UpdateMailTrait;

    public function getCreationTimestamp(): int
    {
        return 1672164687;
    }

    public function update(Connection $connection): void
    {
        $update = new MailUpdate(
            MailTemplateTypes::MAILTYPE_USER_RECOVERY_REQUEST,
            $this->getContentPlainEn(),
            $this->getContentHtmlEn()
        );

        $this->updateEnMail($connection$update);
    }

    public function updateDestructive(Connection $connection): void
    {
        // implement update destructive
class Migration1617864895UpdateMailTemplateForNestedLineItems extends MigrationStep
{
    use UpdateMailTrait;

    public function getCreationTimestamp(): int
    {
        return 1617864895;
    }

    public function update(Connection $connection): void
    {
        $update = new MailUpdate(
            MailTemplateTypes::MAILTYPE_ORDER_CONFIRM,
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/order_confirmation_mail/en-plain.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/order_confirmation_mail/en-html.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/order_confirmation_mail/de-plain.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/order_confirmation_mail/de-html.html.twig')
        );

        $this->updateMail($update$connection);

        $update = new MailUpdate(
            MailTemplateTypes::MAILTYPE_STATE_ENTER_ORDER_TRANSACTION_STATE_CANCELLED,
            
class Migration1600778848AddOrderMails extends MigrationStep
{
    use UpdateMailTrait;

    public function getCreationTimestamp(): int
    {
        return 1600778848;
    }

    public function update(Connection $connection): void
    {
        $update = new MailUpdate(
            'order_confirmation_mail',
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/order_confirmation_mail/en-plain.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/order_confirmation_mail/en-html.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/order_confirmation_mail/de-plain.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/order_confirmation_mail/de-html.html.twig')
        );

        $this->updateMail($update$connection);

        $update = new MailUpdate(
            'order_transaction.state.cancelled',
            
class Migration1669316067ChangeColumnTitleInDownloadsDeliveryMailTemplate extends MigrationStep
{
    use UpdateMailTrait;

    public function getCreationTimestamp(): int
    {
        return 1669316067;
    }

    public function update(Connection $connection): void
    {
        $updateDownloadsDeliveryMailTemplate = new MailUpdate(
            MailTemplateTypes::MAILTYPE_DOWNLOADS_DELIVERY,
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/downloads_delivery/en-plain.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/downloads_delivery/en-html.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/downloads_delivery/de-plain.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/downloads_delivery/de-html.html.twig'),
        );
        $this->updateMail($updateDownloadsDeliveryMailTemplate$connection);
    }

    public function updateDestructive(Connection $connection): void
    {
        
class Migration1663238480FixMailTemplateFallbackChainUsage extends MigrationStep
{
    use UpdateMailTrait;

    public function getCreationTimestamp(): int
    {
        return 1663238480;
    }

    public function update(Connection $connection): void
    {
        $updateCustomerGroupRegistrationAcceptedMail = new MailUpdate(
            MailTemplateTypes::MAILTYPE_CUSTOMER_GROUP_REGISTRATION_ACCEPTED,
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/customer.group.registration.accepted/en-plain.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/customer.group.registration.accepted/en-html.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/customer.group.registration.accepted/de-plain.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/customer.group.registration.accepted/de-html.html.twig'),
        );
        $this->updateMail($updateCustomerGroupRegistrationAcceptedMail$connection);

        $updateCustomerGroupRegistrationDeclinedMail = new MailUpdate(
            MailTemplateTypes::MAILTYPE_CUSTOMER_GROUP_REGISTRATION_DECLINED,
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/customer.group.registration.declined/en-plain.html.twig'),
            

    use UpdateMailTrait;

    public function getCreationTimestamp(): int
    {
        return 1607500561;
    }

    public function update(Connection $connection): void
    {
        // update customer registration         $mailUpdate = new MailUpdate(
            MailTemplateTypes::MAILTYPE_CUSTOMER_REGISTER,
            $this->getSignupPlainTemplateEn(),
            $this->getSignupHtmlTemplateEn(),
            $this->getSignupPlainTemplateDe(),
            $this->getSignupHtmlTemplateDe()
        );

        $this->updateMail($mailUpdate$connection);

        $mailSubjectUpdate = new MailSubjectUpdate(
            MailTemplateTypes::MAILTYPE_CUSTOMER_REGISTER,
            
class Migration1625554302UpdateMailTemplateForContactForm extends MigrationStep
{
    use UpdateMailTrait;

    public function getCreationTimestamp(): int
    {
        return 1625554302;
    }

    public function update(Connection $connection): void
    {
        $update = new MailUpdate(
            MailTemplateTypes::MAILTYPE_CONTACT_FORM,
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/contact_form/en-plain.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/contact_form/en-html.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/contact_form/de-plain.html.twig'),
            (string) file_get_contents(__DIR__ . '/../Fixtures/mails/contact_form/de-html.html.twig')
        );

        $this->updateMail($update$connection);
    }

    public function updateDestructive(Connection $connection): void
    {
Home | Imprint | This part of the site doesn't use cookies.