[#256] Créer une nouvelle réception (étape 3 - bovin) (!11)

| Numéro du ticket | Titre du ticket |
|------------------|-----------------|
|       256           | Créer une nouvelle réception (étape 3 - bovin)                |

## Description de la PR

## Modification du .env

## Check list

- [x ] Pas de régression
- [ ] TU/TI/TF rédigée
- [x ] TU/TI/TF OK
- [x ] CHANGELOG modifié

Co-authored-by: tristan <tristan@yuno.malio.fr>
Reviewed-on: https://gitea.malio.fr/MALIO-DEV/Ferme/pulls/11
Co-authored-by: kevin <kevin@yuno.malio.fr>
Co-committed-by: kevin <kevin@yuno.malio.fr>
This commit is contained in:
kevin
2026-02-05 09:29:29 +00:00
committed by Autin
parent 80d87b7c9b
commit e9948d6ac3
21 changed files with 890 additions and 110 deletions
+63 -6
View File
@@ -75,27 +75,27 @@ class Reception
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
#[Groups(['reception:read'])]
#[Groups(['reception:read', 'reception-bovine:read'])]
private ?int $id = null;
#[ORM\Column(length: 20, nullable: true)]
#[Groups(['reception:read', 'reception:write'])]
#[Groups(['reception:read', 'reception:write', 'reception-bovine:read'])]
private ?string $licensePlate = null;
#[ORM\Column(length: 20, unique: true, nullable: true)]
#[Groups(['reception:read'])]
#[Groups(['reception:read', 'reception-bovine:read'])]
private ?string $identificationNumber = null;
#[ORM\Column(options: ['default' => 0])]
#[Groups(['reception:read', 'reception:write'])]
#[Groups(['reception:read', 'reception:write', 'reception-bovine:read'])]
private int $currentStep = 0;
#[ORM\Column(options: ['default' => false])]
#[Groups(['reception:read', 'reception:write'])]
#[Groups(['reception:read', 'reception:write', 'reception-bovine:read'])]
private bool $isValid = false;
#[ORM\Column(name: 'date_reception', type: 'datetime_immutable')]
#[Groups(['reception:read', 'reception:write'])]
#[Groups(['reception:read', 'reception:write', 'reception-bovine:read'])]
#[Context([DateTimeNormalizer::FORMAT_KEY => 'Y-m-d'])]
private ?DateTimeImmutable $receptionDate = null;
@@ -171,6 +171,20 @@ class Reception
#[ApiProperty(readableLink: true)]
private ?Driver $driver = null;
/**
* @var Collection<int, ReceptionBovine>
*/
#[ORM\OneToMany(targetEntity: ReceptionBovine::class, mappedBy: 'reception', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[Assert\Range(
min: 0
)]
#[Groups(['reception:read', 'reception:write'])]
private Collection $bovines_types;
#[ORM\Column(length: 255, nullable: true)]
#[Groups(['reception:read', 'reception:write'])]
private ?string $bovineDetail = null;
public function __construct(
?DateTimeImmutable $receptionDate = null,
) {
@@ -178,6 +192,7 @@ class Reception
$this->weights = new ArrayCollection();
$this->buildings = new ArrayCollection();
$this->pelletBuildings = new ArrayCollection();
$this->bovines_types = new ArrayCollection();
}
public function getId(): ?int
@@ -472,4 +487,46 @@ class Reception
)
;
}
/**
* @return Collection<int, ReceptionBovine>
*/
public function getBovinesTypes(): Collection
{
return $this->bovines_types;
}
public function addBovinesType(ReceptionBovine $bovinesType): static
{
if (!$this->bovines_types->contains($bovinesType)) {
$this->bovines_types->add($bovinesType);
$bovinesType->setReception($this);
}
return $this;
}
public function removeBovinesType(ReceptionBovine $bovinesType): static
{
if ($this->bovines_types->removeElement($bovinesType)) {
// set the owning side to null (unless already changed)
if ($bovinesType->getReception() === $this) {
$bovinesType->setReception(null);
}
}
return $this;
}
public function getBovineDetail(): ?string
{
return $this->bovineDetail;
}
public function setBovineDetail(?string $bovineDetail): static
{
$this->bovineDetail = $bovineDetail;
return $this;
}
}