migrations/Version20240821095218DataUpdate.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use App\Entity\Notification\NotificationArea;
  5. use App\Repository\Notification\NotificationAreaRepository;
  6. use Doctrine\DBAL\Schema\Schema;
  7. use Doctrine\Migrations\AbstractMigration;
  8. use Symfony\Component\DependencyInjection\ContainerAwareInterface;
  9. use Symfony\Component\DependencyInjection\ContainerAwareTrait;
  10. /**
  11.  * Auto-generated Migration: Please modify to your needs!
  12.  */
  13. final class Version20240821095218DataUpdate extends AbstractMigration implements ContainerAwareInterface
  14. {
  15.     use ContainerAwareTrait;
  16.     public function getDescription(): string
  17.     {
  18.         return '';
  19.     }
  20.     public function up(Schema $schema): void
  21.     {
  22.         $entityManager $this->container->get('doctrine.orm.entity_manager');
  23.         /** @var NotificationAreaRepository $notificationAreaRepository */
  24.         $notificationAreaRepository $entityManager->getRepository(NotificationArea::class);
  25.         $surveyAccepted $notificationAreaRepository->getNotificationAreaSurveyAccepted();
  26.         $surveyAccepted->setVisibleName('Data Approved');
  27.         $entityManager->persist($surveyAccepted);
  28.         $surveyRejected $notificationAreaRepository->getNotificationAreaSurveyReject();
  29.         $surveyRejected->setVisibleName('Data Rejected');
  30.         $entityManager->persist($surveyRejected);
  31.         $entityManager->flush();
  32.     }
  33. }