Abdallah Kharchafi
Abdallah Kharchafi

Reputation: 41

Update confirmation email migration

I'm trying to change the content of email template 'customer_user_confirmation_email'. So i created a AbstractHashEmailMigration like mentionned in https://doc.oroinc.com/bundles/platform/EmailBundle/email-templates-migrations/ But it wont update the changes

class GdmEmailTemplate extends AbstractHashEmailMigration
{
    /**
     * {@inheritdoc}
     */
    protected function getEmailHashesToUpdate(): array
    {
        return [
            'customer_user_confirmation_email_gdm' => ['c9a6191f197cb5d3c7bf166c6a246e42']
        ];
    }

    /**
     * Return path to email templates
     *
     * @return string
     */
    public function getEmailsDir()
    {
        return $this->container
            ->get('kernel')
            ->locateResource('GDM/Bundle/CustomerUserBundle/Migrations/Data/ORM/data/emails/customer-user');
    }
}

I dont know what to add in Migrations>Data>ORM>Schema>vx_y to load the changes, i run oro:migration:load and clear cach but nothing happens

Upvotes: 1

Views: 76

Answers (1)

Andrey Yatsenko
Andrey Yatsenko

Reputation: 1956

  • Schema migrations are for changing the database schema
  • Data migrations (also called data fixtures) are for filling the database with the data.

Email templates changes are not related to schema migrations. So there is nothing to do with the Schema>vx_y folder.

See the documentation on working with the data fixture (or data migration) instead.

To summarize, your Data Migration must be placed to Migrations/Data/ORM/ folder in a bundle and then executed with the oro:migration:data:load command as mentioned in the above documentation.

P.S. Probably, the name of the abstract class must be changed to AbstractHashEmailDataFixture or something else less confusing.

Upvotes: 1

Related Questions