feat(workflow) : ajoute workflow et category sur TaskStatus
This commit is contained in:
@@ -10,9 +10,11 @@ use ApiPlatform\Metadata\Get;
|
||||
use ApiPlatform\Metadata\GetCollection;
|
||||
use ApiPlatform\Metadata\Patch;
|
||||
use ApiPlatform\Metadata\Post;
|
||||
use App\Enum\StatusCategory;
|
||||
use App\Repository\TaskStatusRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Attribute\Groups;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
#[ApiResource(
|
||||
operations: [
|
||||
@@ -32,25 +34,36 @@ class TaskStatus
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
#[Groups(['task_status:read', 'task:read'])]
|
||||
#[Groups(['task_status:read', 'task:read', 'workflow:read', 'project:read'])]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
#[Groups(['task_status:read', 'task_status:write', 'task:read'])]
|
||||
#[Groups(['task_status:read', 'task_status:write', 'task:read', 'workflow:read', 'project:read'])]
|
||||
private ?string $label = null;
|
||||
|
||||
#[ORM\Column(length: 7)]
|
||||
#[Groups(['task_status:read', 'task_status:write', 'task:read'])]
|
||||
#[Groups(['task_status:read', 'task_status:write', 'task:read', 'workflow:read', 'project:read'])]
|
||||
private ?string $color = '#222783';
|
||||
|
||||
#[ORM\Column]
|
||||
#[Groups(['task_status:read', 'task_status:write', 'task:read'])]
|
||||
#[Groups(['task_status:read', 'task_status:write', 'task:read', 'workflow:read', 'project:read'])]
|
||||
private ?int $position = 0;
|
||||
|
||||
#[ORM\Column(type: 'boolean')]
|
||||
#[Groups(['task_status:read', 'task_status:write', 'task:read'])]
|
||||
#[Groups(['task_status:read', 'task_status:write', 'task:read', 'workflow:read', 'project:read'])]
|
||||
private bool $isFinal = false;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: Workflow::class, inversedBy: 'statuses')]
|
||||
#[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')]
|
||||
#[Groups(['task_status:read', 'task_status:write', 'task:read'])]
|
||||
#[Assert\NotNull]
|
||||
private ?Workflow $workflow = null;
|
||||
|
||||
#[ORM\Column(type: 'string', length: 32, enumType: StatusCategory::class)]
|
||||
#[Groups(['task_status:read', 'task_status:write', 'task:read', 'workflow:read', 'project:read'])]
|
||||
#[Assert\NotNull]
|
||||
private ?StatusCategory $category = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
@@ -103,4 +116,28 @@ class TaskStatus
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getWorkflow(): ?Workflow
|
||||
{
|
||||
return $this->workflow;
|
||||
}
|
||||
|
||||
public function setWorkflow(?Workflow $workflow): static
|
||||
{
|
||||
$this->workflow = $workflow;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCategory(): ?StatusCategory
|
||||
{
|
||||
return $this->category;
|
||||
}
|
||||
|
||||
public function setCategory(StatusCategory $category): static
|
||||
{
|
||||
$this->category = $category;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user