|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +namespace App\Entity; |
| 6 | + |
| 7 | +use App\Dbal\Types\AlnTimeType; |
| 8 | +use App\Repository\AlnManualMealRepository; |
| 9 | +use Doctrine\DBAL\Types\Types; |
| 10 | +use Doctrine\ORM\Mapping as ORM; |
| 11 | + |
| 12 | +#[ORM\Entity(repositoryClass: AlnManualMealRepository::class)] |
| 13 | +class AlnManualMeal |
| 14 | +{ |
| 15 | + #[ORM\Id] |
| 16 | + #[ORM\GeneratedValue] |
| 17 | + #[ORM\Column()] |
| 18 | + private ?int $id = null; |
| 19 | + |
| 20 | + #[ORM\ManyToOne(inversedBy: 'meals')] |
| 21 | + #[ORM\JoinColumn(nullable: false)] |
| 22 | + private ?AlnFeeder $feeder = null; |
| 23 | + |
| 24 | + #[ORM\Column(type: Types::DATETIME_IMMUTABLE, nullable: true)] |
| 25 | + private ?\DateTimeImmutable $distributedOn = null; |
| 26 | + |
| 27 | + /** |
| 28 | + * @var int<5, 150> |
| 29 | + */ |
| 30 | + #[ORM\Column(type: Types::SMALLINT)] |
| 31 | + private int $amount; |
| 32 | + |
| 33 | + /** |
| 34 | + * @var ?array{hours: int<0, 23>, minutes: int<0, 59>} |
| 35 | + */ |
| 36 | + #[ORM\Column(type: AlnTimeType::ALN_TIME_TYPE, nullable: true)] |
| 37 | + private ?array $previousMeal = null; |
| 38 | + |
| 39 | + public function __construct() |
| 40 | + { |
| 41 | + $this->amount = 5; |
| 42 | + } |
| 43 | + |
| 44 | + public function getId(): ?int |
| 45 | + { |
| 46 | + return $this->id; |
| 47 | + } |
| 48 | + |
| 49 | + public function getFeeder(): ?AlnFeeder |
| 50 | + { |
| 51 | + return $this->feeder; |
| 52 | + } |
| 53 | + |
| 54 | + public function setFeeder(?AlnFeeder $feeder): self |
| 55 | + { |
| 56 | + $this->feeder = $feeder; |
| 57 | + |
| 58 | + return $this; |
| 59 | + } |
| 60 | + |
| 61 | + public function getDistributedOn(): ?\DateTimeImmutable |
| 62 | + { |
| 63 | + return $this->distributedOn; |
| 64 | + } |
| 65 | + |
| 66 | + public function setDistributedOn(?\DateTimeImmutable $distributedOn): self |
| 67 | + { |
| 68 | + $this->distributedOn = $distributedOn; |
| 69 | + |
| 70 | + return $this; |
| 71 | + } |
| 72 | + |
| 73 | + /** |
| 74 | + * @return int<5, 150> |
| 75 | + */ |
| 76 | + public function getAmount(): int |
| 77 | + { |
| 78 | + return $this->amount; |
| 79 | + } |
| 80 | + |
| 81 | + /** |
| 82 | + * @param int<5, 150> $amount |
| 83 | + */ |
| 84 | + public function setAmount(int $amount): self |
| 85 | + { |
| 86 | + $this->amount = $amount; |
| 87 | + |
| 88 | + return $this; |
| 89 | + } |
| 90 | + |
| 91 | + /** |
| 92 | + * @return ?array{hours: int<0, 23>, minutes: int<0, 59>} |
| 93 | + */ |
| 94 | + public function getPreviousMeal(): ?array |
| 95 | + { |
| 96 | + return $this->previousMeal; |
| 97 | + } |
| 98 | + |
| 99 | + /** |
| 100 | + * @param ?array{hours: int<0, 23>, minutes: int<0, 59>} $previousMeal |
| 101 | + */ |
| 102 | + public function setPreviousMeal(?array $previousMeal): self |
| 103 | + { |
| 104 | + $this->previousMeal = $previousMeal; |
| 105 | + |
| 106 | + return $this; |
| 107 | + } |
| 108 | +} |
0 commit comments