Task: add "completed" flag

master
Julien Rosset 1 month ago
parent 81bf848698
commit 38a992eb04

@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250625122643 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql(<<<'SQL'
ALTER TABLE task ADD completed TINYINT(1) NOT NULL
SQL);
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql(<<<'SQL'
ALTER TABLE task DROP completed
SQL);
}
}

@ -56,6 +56,12 @@ class Task {
#[Assert\PositiveOrZero(message: 'La quantité de départ doit être positive ou nulle')]
private ?int $quantityProvidedAtStart = null;
/**
* @var bool|null The task is completed?
*/
#[ORM\Column]
private ?bool $completed = null;
/**
* @var Task|null The parent task
*/
@ -189,6 +195,29 @@ class Task {
return $this;
}
/**
* The task is completed?
*
* @return bool|null The task is completed?
*/
public function isCompleted(): ?bool
{
return $this->completed;
}
/**
* Set if the task is completed
*
* @param bool $completed The task is completed?
*
* @return $this
*/
public function setCompleted(bool $completed): static
{
$this->completed = $completed;
return $this;
}
/**
* The parent task
*

Loading…
Cancel
Save