From ebf89d19c3bd7a0b447e5780f75a5cbae322518a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Thu, 18 Jul 2024 12:54:56 +0200 Subject: [PATCH] feat: additional 'deleted' status for assignments --- migrations/Version20240718105318.php | 31 +++++++++++++++++++ .../Assignment/DeleteController.php | 2 ++ src/Entity/Assignment.php | 1 + 3 files changed, 34 insertions(+) create mode 100644 migrations/Version20240718105318.php diff --git a/migrations/Version20240718105318.php b/migrations/Version20240718105318.php new file mode 100644 index 0000000..0d4fa68 --- /dev/null +++ b/migrations/Version20240718105318.php @@ -0,0 +1,31 @@ +connection->executeQuery('UPDATE assignment SET status=? WHERE deleted_at is NOT NULL', [Assignment::STATUS_DELETED]); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + + } +} diff --git a/src/Controller/Administrative/Assignment/DeleteController.php b/src/Controller/Administrative/Assignment/DeleteController.php index c53af97..d2f7744 100644 --- a/src/Controller/Administrative/Assignment/DeleteController.php +++ b/src/Controller/Administrative/Assignment/DeleteController.php @@ -26,6 +26,8 @@ class DeleteController extends AbstractController { if (true === $request->isMethod('POST')) { $assignment->setDeleted(); + $assignment->setStatus(Assignment::STATUS_DELETED); + $this->entityManager->flush(); $this->logger->info('Delete assignment', [ diff --git a/src/Entity/Assignment.php b/src/Entity/Assignment.php index 86f181c..0ca50e1 100644 --- a/src/Entity/Assignment.php +++ b/src/Entity/Assignment.php @@ -28,6 +28,7 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa public const STATUS_PARTLY_STAFFED = 'partly_staffed'; public const STATUS_STAFFING = 'staffing'; public const STATUS_UNSTAFFED = 'unstaffed'; + public const STATUS_DELETED = 'deleted'; #[ORM\Id] #[ORM\GeneratedValue]