From d2b95c098e23d7c7d29e29874df792b69bfcf2f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Poirier=20Th=C3=A9or=C3=AAt?= Date: Wed, 8 May 2024 09:25:21 -0400 Subject: [PATCH] [CronJob] Add notes to CronJob entity --- app/migrations/Version20240508132341.php | 29 +++++++++++++++++++ packages/cron-job/Entity/CronJob.php | 15 ++++++++++ .../CronJob/Admin/CronJobAdmin.php | 2 ++ 3 files changed, 46 insertions(+) create mode 100644 app/migrations/Version20240508132341.php diff --git a/app/migrations/Version20240508132341.php b/app/migrations/Version20240508132341.php new file mode 100644 index 00000000..fbb09922 --- /dev/null +++ b/app/migrations/Version20240508132341.php @@ -0,0 +1,29 @@ +addSql('ALTER TABLE cron_job__cron_job ADD notes LONGTEXT DEFAULT NULL'); + } + + public function down(Schema $schema): void + { + } +} diff --git a/packages/cron-job/Entity/CronJob.php b/packages/cron-job/Entity/CronJob.php index c795b7c9..a34ef435 100644 --- a/packages/cron-job/Entity/CronJob.php +++ b/packages/cron-job/Entity/CronJob.php @@ -53,6 +53,9 @@ class CronJob implements \Stringable #[Assert\Range(min: 0, max: 255)] private ?int $priority = null; + #[ORM\Column(name: 'notes', type: 'text', nullable: true)] + private ?string $notes = null; + /** * @var Selectable&Collection */ @@ -153,6 +156,18 @@ public function setPriority(?int $priority): self return $this; } + public function getNotes(): ?string + { + return $this->notes; + } + + public function setNotes(?string $notes): CronJob + { + $this->notes = $notes; + + return $this; + } + /** * @return Selectable&Collection */ diff --git a/packages/sonata-integration-bundle/CronJob/Admin/CronJobAdmin.php b/packages/sonata-integration-bundle/CronJob/Admin/CronJobAdmin.php index c68fac7a..fc116709 100644 --- a/packages/sonata-integration-bundle/CronJob/Admin/CronJobAdmin.php +++ b/packages/sonata-integration-bundle/CronJob/Admin/CronJobAdmin.php @@ -56,6 +56,7 @@ protected function configureFormFields(FormMapper $form): void $form ->with('Definition', ['class' => 'col-md-8']) ->add('name') + ->add('notes') ->add( 'command', null, @@ -79,6 +80,7 @@ protected function configureShowFields(ShowMapper $show): void $show ->add('name') + ->add('notes') ->add('command') ->add('schedule') ->add('active')