<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use App\Entity\FunctionalEvaluation;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
use Doctrine\ORM\EntityManager;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
final class Version20221118120056 extends AbstractMigration implements ContainerAwareInterface
{
private EntityManager $em;
private ContainerInterface $container;
public function setContainer(ContainerInterface $container = null)
{
$this->container = $container;
$this->em = $container->get('doctrine')->getManager();
}
public function getDescription(): string
{
return 'update functional Evaluation name';
}
public function up(Schema $schema): void
{
}
public function postUp(Schema $schema): void
{
$functionalEvaluation = $this->em->getRepository(FunctionalEvaluation::class)->findOneBy(['name' => 'Gestion electronique des documents']);
if ($functionalEvaluation) {
$functionalEvaluation->setName('Gestion électronique des documents');
$this->em->persist($functionalEvaluation);
}
$this->em->flush();
}
public function down(Schema $schema): void
{
}
}