<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use App\Entity\Workflow\MailTag;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20240506112902DataUpdate extends AbstractMigration implements ContainerAwareInterface
{
use ContainerAwareTrait;
private $mailTags = [
[
'name' => MailTag::MAIL_TAG_RECEIVER,
'visibleName' => '[@receiver]',
'description' => 'Show the reciever\'s name and surname.',
],
[
'name' => MailTag::MAIL_TAG_COMPANY_NAME,
'visibleName' => '[@companyName]',
'description' => 'Show client\'s company name.',
],
[
'name' => MailTag::MAIL_TAG_PROJECT_NAME,
'visibleName' => '[@projectName]',
'description' => 'Show project\'s name.',
],
[
'name' => MailTag::MAIL_TAG_PROJECT_MANAGER_NAME,
'visibleName' => '[@projectManagerName]',
'description' => 'Show project manager name and surname.',
],
[
'name' => MailTag::MAIL_TAG_PROJECT_STATUS_NAME,
'visibleName' => '[@projectStatusName]',
'description' => 'Show project\'s status name.',
],
[
'name' => MailTag::MAIL_TAG_DATE_TODAY,
'visibleName' => '[@dateToday]',
'description' => 'Show date on the day the email was sent.',
],
];
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
$entityManager = $this->container->get('doctrine.orm.entity_manager');
foreach ($this->mailTags as $mailTag) {
$newMailTag = new MailTag();
$newMailTag->setName($mailTag['name']);
$newMailTag->setVisibleName($mailTag['visibleName']);
$newMailTag->setDescription($mailTag['description']);
$entityManager->persist($newMailTag);
}
$entityManager->flush();
}
public function down(Schema $schema): void
{
}
}