-
-
- pesée à vide
-
-
- pesée à plein
-
-
+
addSql('ALTER TABLE bovine ADD mother_national_number VARCHAR(50) DEFAULT NULL');
+ $this->addSql('ALTER TABLE bovine ADD father_national_number VARCHAR(50) DEFAULT NULL');
+ $this->addSql('ALTER TABLE bovine ADD mother_bovine_type_id INT DEFAULT NULL');
+ $this->addSql('ALTER TABLE bovine ADD father_bovine_type_id INT DEFAULT NULL');
+ $this->addSql('ALTER TABLE bovine ADD CONSTRAINT FK_2068337F14E5E9FB FOREIGN KEY (mother_bovine_type_id) REFERENCES bovine_type (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
+ $this->addSql('ALTER TABLE bovine ADD CONSTRAINT FK_2068337F53F12909 FOREIGN KEY (father_bovine_type_id) REFERENCES bovine_type (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
+ $this->addSql('CREATE INDEX IDX_2068337F14E5E9FB ON bovine (mother_bovine_type_id)');
+ $this->addSql('CREATE INDEX IDX_2068337F53F12909 ON bovine (father_bovine_type_id)');
+ }
+
+ public function down(Schema $schema): void
+ {
+ $this->addSql('ALTER TABLE bovine DROP CONSTRAINT FK_2068337F14E5E9FB');
+ $this->addSql('ALTER TABLE bovine DROP CONSTRAINT FK_2068337F53F12909');
+ $this->addSql('DROP INDEX IDX_2068337F14E5E9FB');
+ $this->addSql('DROP INDEX IDX_2068337F53F12909');
+ $this->addSql('ALTER TABLE bovine DROP mother_national_number');
+ $this->addSql('ALTER TABLE bovine DROP father_national_number');
+ $this->addSql('ALTER TABLE bovine DROP mother_bovine_type_id');
+ $this->addSql('ALTER TABLE bovine DROP father_bovine_type_id');
+ }
+}
diff --git a/src/Entity/Bovine.php b/src/Entity/Bovine.php
index 656fd78..2cc3796 100644
--- a/src/Entity/Bovine.php
+++ b/src/Entity/Bovine.php
@@ -135,6 +135,24 @@ class Bovine
#[Context([DateTimeNormalizer::FORMAT_KEY => 'Y-m-d'])]
private ?DateTimeImmutable $exitedAt = null;
+ #[ORM\Column(length: 50, nullable: true)]
+ #[Groups(['bovine:read'])]
+ private ?string $motherNationalNumber = null;
+
+ #[ORM\ManyToOne]
+ #[Groups(['bovine:read'])]
+ #[ApiProperty(readableLink: true)]
+ private ?BovineType $motherBovineType = null;
+
+ #[ORM\Column(length: 50, nullable: true)]
+ #[Groups(['bovine:read'])]
+ private ?string $fatherNationalNumber = null;
+
+ #[ORM\ManyToOne]
+ #[Groups(['bovine:read'])]
+ #[ApiProperty(readableLink: true)]
+ private ?BovineType $fatherBovineType = null;
+
public function getId(): ?int
{
return $this->id;
@@ -329,6 +347,54 @@ class Bovine
return $this;
}
+ public function getMotherNationalNumber(): ?string
+ {
+ return $this->motherNationalNumber;
+ }
+
+ public function setMotherNationalNumber(?string $motherNationalNumber): static
+ {
+ $this->motherNationalNumber = $motherNationalNumber;
+
+ return $this;
+ }
+
+ public function getMotherBovineType(): ?BovineType
+ {
+ return $this->motherBovineType;
+ }
+
+ public function setMotherBovineType(?BovineType $motherBovineType): static
+ {
+ $this->motherBovineType = $motherBovineType;
+
+ return $this;
+ }
+
+ public function getFatherNationalNumber(): ?string
+ {
+ return $this->fatherNationalNumber;
+ }
+
+ public function setFatherNationalNumber(?string $fatherNationalNumber): static
+ {
+ $this->fatherNationalNumber = $fatherNationalNumber;
+
+ return $this;
+ }
+
+ public function getFatherBovineType(): ?BovineType
+ {
+ return $this->fatherBovineType;
+ }
+
+ public function setFatherBovineType(?BovineType $fatherBovineType): static
+ {
+ $this->fatherBovineType = $fatherBovineType;
+
+ return $this;
+ }
+
#[ORM\PrePersist]
#[ORM\PreUpdate]
public function refreshAgeMonths(): void
diff --git a/src/State/Bovin/BovineSyncInventoryProcessor.php b/src/State/Bovin/BovineSyncInventoryProcessor.php
index 5fb6c71..176e6e6 100644
--- a/src/State/Bovin/BovineSyncInventoryProcessor.php
+++ b/src/State/Bovin/BovineSyncInventoryProcessor.php
@@ -99,6 +99,11 @@ final class BovineSyncInventoryProcessor implements ProcessorInterface
$bovine->setBovineType($this->resolveBovineType($identification->breedType));
$bovine->setWorkNumber($identification->workNumber);
$bovine->setBirthDate($identification->birthDate?->date);
+
+ $bovine->setMotherNationalNumber($identification->motherCarrier?->bovin?->nationalNumber);
+ $bovine->setMotherBovineType($this->resolveBovineType($identification->motherCarrier?->breedType));
+ $bovine->setFatherNationalNumber($identification->fatherIpg?->bovin?->nationalNumber);
+ $bovine->setFatherBovineType($this->resolveBovineType($identification->fatherIpg?->breedType));
}
$latestEntry = null;