<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use App\Entity\Notification\NotificationArea;
use Cron\CronBundle\Entity\CronJob;
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 Version20240614124034DataUpdate extends AbstractMigration implements ContainerAwareInterface
{
use ContainerAwareTrait;
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
/** @var EntityManagerInterface $entityManger */
$entityManager = $this->container->get('doctrine.orm.entity_manager');
$cronJobSendNotification = new CronJob();
$cronJobSendNotification
->setName('sendNotification')
->setCommand('app:notifications:cron')
->setSchedule('0 0 * * *')
->setDescription('Send notification - daily check')
->setEnabled(true);
$entityManager->persist($cronJobSendNotification);
$cronJobChangeProjectStatus = new CronJob();
$cronJobChangeProjectStatus
->setName('changeProjectConditionStatus')
->setCommand('app:project:cron')
->setSchedule('0 1 * * *')
->setDescription('Change project condition status')
->setEnabled(true);
$entityManager->persist($cronJobChangeProjectStatus);
$cronJobAutoWorkflow = new CronJob();
$cronJobAutoWorkflow
->setName('autoWorkflow')
->setCommand('app:workflow:checkTask')
->setSchedule('*/1 * * * *')
->setDescription('Check schedule workflow')
->setEnabled(true);
$entityManager->persist($cronJobAutoWorkflow);
$cronJobNotificationSystem = new CronJob();
$cronJobNotificationSystem
->setName('systemNotification')
->setCommand('app:notifications:system-cron')
->setSchedule('0 * * * *')
->setDescription('Send system notification on schedule')
->setEnabled(true);
$entityManager->persist($cronJobNotificationSystem);
$entityManager->flush();
}
}