Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
18 / 18 |
|
100.00% |
12 / 12 |
CRAP | |
100.00% |
1 / 1 |
| Task | |
100.00% |
18 / 18 |
|
100.00% |
12 / 12 |
12 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getCreatedAt | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setCreatedAt | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getTitle | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setTitle | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getContent | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setContent | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| isIsDone | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setIsDone | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getAuthor | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setAuthor | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Entity; |
| 4 | |
| 5 | use App\Entity\User; |
| 6 | use Doctrine\DBAL\Types\Types; |
| 7 | use Doctrine\ORM\Mapping as ORM; |
| 8 | use App\Repository\TaskRepository; |
| 9 | use Symfony\Component\Validator\Constraints as Assert; |
| 10 | |
| 11 | #[ORM\Entity(repositoryClass: TaskRepository::class)] |
| 12 | class Task |
| 13 | { |
| 14 | #[ORM\Id] |
| 15 | #[ORM\GeneratedValue] |
| 16 | #[ORM\Column] |
| 17 | private ?int $id = null; |
| 18 | |
| 19 | #[ORM\Column] |
| 20 | private ?\DateTimeImmutable $createdAt = null; |
| 21 | |
| 22 | #[ORM\Column(length: 255)] |
| 23 | #[Assert\NotBlank(message: 'Vous devez saisir un titre')] |
| 24 | #[Assert\Length(min: 3, minMessage: 'Le titre doit contenir au moins {{ limit }} caractères')] |
| 25 | private ?string $title = null; |
| 26 | |
| 27 | #[ORM\Column(type: Types::TEXT)] |
| 28 | #[Assert\NotBlank(message: 'Vous devez saisir un contenu')] |
| 29 | private ?string $content = null; |
| 30 | |
| 31 | #[ORM\Column] |
| 32 | private ?bool $isDone = null; |
| 33 | |
| 34 | #[ORM\ManyToOne(inversedBy: 'tasks')] |
| 35 | private ?User $author = null; |
| 36 | |
| 37 | public function __construct() |
| 38 | { |
| 39 | $this->createdAt = new \DateTimeImmutable(); |
| 40 | $this->isDone = false; |
| 41 | } |
| 42 | |
| 43 | public function getId(): ?int |
| 44 | { |
| 45 | return $this->id; |
| 46 | } |
| 47 | |
| 48 | public function getCreatedAt(): ?\DateTimeImmutable |
| 49 | { |
| 50 | return $this->createdAt; |
| 51 | } |
| 52 | |
| 53 | public function setCreatedAt(\DateTimeImmutable $createdAt): self |
| 54 | { |
| 55 | $this->createdAt = $createdAt; |
| 56 | |
| 57 | return $this; |
| 58 | } |
| 59 | |
| 60 | public function getTitle(): ?string |
| 61 | { |
| 62 | return $this->title; |
| 63 | } |
| 64 | |
| 65 | public function setTitle(string $title): self |
| 66 | { |
| 67 | $this->title = $title; |
| 68 | |
| 69 | return $this; |
| 70 | } |
| 71 | |
| 72 | public function getContent(): ?string |
| 73 | { |
| 74 | return $this->content; |
| 75 | } |
| 76 | |
| 77 | public function setContent(string $content): self |
| 78 | { |
| 79 | $this->content = $content; |
| 80 | |
| 81 | return $this; |
| 82 | } |
| 83 | |
| 84 | public function isIsDone(): ?bool |
| 85 | { |
| 86 | return $this->isDone; |
| 87 | } |
| 88 | |
| 89 | public function setIsDone(bool $isDone): self |
| 90 | { |
| 91 | $this->isDone = $isDone; |
| 92 | |
| 93 | return $this; |
| 94 | } |
| 95 | |
| 96 | public function getAuthor(): ?user |
| 97 | { |
| 98 | return $this->author; |
| 99 | } |
| 100 | |
| 101 | public function setAuthor(?user $author): self |
| 102 | { |
| 103 | $this->author = $author; |
| 104 | |
| 105 | return $this; |
| 106 | } |
| 107 | } |