migrations/Version20240614124034DataUpdate.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 Cron\CronBundle\Entity\CronJob;
  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 Version20240614124034DataUpdate 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.         /** @var EntityManagerInterface $entityManger */
  23.         $entityManager $this->container->get('doctrine.orm.entity_manager');
  24.         $cronJobSendNotification = new CronJob();
  25.         $cronJobSendNotification
  26.             ->setName('sendNotification')
  27.             ->setCommand('app:notifications:cron')
  28.             ->setSchedule('0 0 * * *')
  29.             ->setDescription('Send notification - daily check')
  30.             ->setEnabled(true);
  31.         $entityManager->persist($cronJobSendNotification);
  32.         $cronJobChangeProjectStatus = new CronJob();
  33.         $cronJobChangeProjectStatus
  34.             ->setName('changeProjectConditionStatus')
  35.             ->setCommand('app:project:cron')
  36.             ->setSchedule('0 1 * * *')
  37.             ->setDescription('Change project condition status')
  38.             ->setEnabled(true);
  39.         $entityManager->persist($cronJobChangeProjectStatus);
  40.         $cronJobAutoWorkflow = new CronJob();
  41.         $cronJobAutoWorkflow
  42.             ->setName('autoWorkflow')
  43.             ->setCommand('app:workflow:checkTask')
  44.             ->setSchedule('*/1 * * * *')
  45.             ->setDescription('Check schedule workflow')
  46.             ->setEnabled(true);
  47.         $entityManager->persist($cronJobAutoWorkflow);
  48.         $cronJobNotificationSystem = new CronJob();
  49.         $cronJobNotificationSystem
  50.             ->setName('systemNotification')
  51.             ->setCommand('app:notifications:system-cron')
  52.             ->setSchedule('0 * * * *')
  53.             ->setDescription('Send system notification on schedule')
  54.             ->setEnabled(true);
  55.         $entityManager->persist($cronJobNotificationSystem);
  56.         $entityManager->flush();
  57.     }
  58. }