<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use App\Entity\ActiveServices\ProjectStatus;
use App\Repository\ActiveServices\ProjectStatusRepository;
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 Version20240724091831DataUpdate extends AbstractMigration implements ContainerAwareInterface
{
use ContainerAwareTrait;
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
$entityManager = $this->container->get('doctrine.orm.entity_manager');
/** @var ProjectStatusRepository $projectRepository */
$projectStatusRepository = $entityManager->getRepository(ProjectStatus::class);
/** @var ProjectStatus $projectStatus */
foreach ($projectStatusRepository->findAll() as $projectStatus) {
if ($projectStatus->getIsEditable()) {
$projectStatus->setName($projectStatus->getName() . '_' . $projectStatus->getId());
$entityManager->persist($projectStatus);
}
}
$entityManager->flush();
}
}