feat: additional 'deleted' status for assignments
This commit is contained in:
@@ -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', [
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user