Fix TaskStatus getter naming (isFinal -> getIsFinal) so Symfony serializer properly exposes the isFinal field. Add archive/unarchive buttons and non-final tasks info message to TaskGroupDrawer. Remove obsolete TaskType entity and repository. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
107 lines
2.4 KiB
PHP
107 lines
2.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Entity;
|
|
|
|
use ApiPlatform\Metadata\ApiResource;
|
|
use ApiPlatform\Metadata\Delete;
|
|
use ApiPlatform\Metadata\Get;
|
|
use ApiPlatform\Metadata\GetCollection;
|
|
use ApiPlatform\Metadata\Patch;
|
|
use ApiPlatform\Metadata\Post;
|
|
use App\Repository\TaskStatusRepository;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Symfony\Component\Serializer\Attribute\Groups;
|
|
|
|
#[ApiResource(
|
|
operations: [
|
|
new GetCollection(),
|
|
new Get(),
|
|
new Post(security: "is_granted('ROLE_ADMIN')"),
|
|
new Patch(security: "is_granted('ROLE_ADMIN')"),
|
|
new Delete(security: "is_granted('ROLE_ADMIN')"),
|
|
],
|
|
normalizationContext: ['groups' => ['task_status:read']],
|
|
denormalizationContext: ['groups' => ['task_status:write']],
|
|
order: ['position' => 'ASC'],
|
|
)]
|
|
#[ORM\Entity(repositoryClass: TaskStatusRepository::class)]
|
|
class TaskStatus
|
|
{
|
|
#[ORM\Id]
|
|
#[ORM\GeneratedValue]
|
|
#[ORM\Column]
|
|
#[Groups(['task_status:read', 'task:read'])]
|
|
private ?int $id = null;
|
|
|
|
#[ORM\Column(length: 255)]
|
|
#[Groups(['task_status:read', 'task_status:write', 'task:read'])]
|
|
private ?string $label = null;
|
|
|
|
#[ORM\Column(length: 7)]
|
|
#[Groups(['task_status:read', 'task_status:write', 'task:read'])]
|
|
private ?string $color = '#222783';
|
|
|
|
#[ORM\Column]
|
|
#[Groups(['task_status:read', 'task_status:write', 'task:read'])]
|
|
private ?int $position = 0;
|
|
|
|
#[ORM\Column(type: 'boolean')]
|
|
#[Groups(['task_status:read', 'task_status:write', 'task:read'])]
|
|
private bool $isFinal = false;
|
|
|
|
public function getId(): ?int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function getLabel(): ?string
|
|
{
|
|
return $this->label;
|
|
}
|
|
|
|
public function setLabel(string $label): static
|
|
{
|
|
$this->label = $label;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getColor(): ?string
|
|
{
|
|
return $this->color;
|
|
}
|
|
|
|
public function setColor(string $color): static
|
|
{
|
|
$this->color = $color;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getPosition(): ?int
|
|
{
|
|
return $this->position;
|
|
}
|
|
|
|
public function setPosition(int $position): static
|
|
{
|
|
$this->position = $position;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getIsFinal(): bool
|
|
{
|
|
return $this->isFinal;
|
|
}
|
|
|
|
public function setIsFinal(bool $isFinal): static
|
|
{
|
|
$this->isFinal = $isFinal;
|
|
|
|
return $this;
|
|
}
|
|
}
|