feat: additional 'deleted' status for assignments

This commit is contained in:
Björn Fromme
2024-07-18 12:54:56 +02:00
parent a1882a4af1
commit ebf89d19c3
3 changed files with 34 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use App\Entity\Assignment;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20240718105318 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
$this->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
}
}
@@ -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', [
+1
View File
@@ -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]