diff --git a/Back_end/src/Entity/FrequenceType.php b/Back_end/src/Entity/FrequenceType.php index ea631dff4b0cb81c55fb3de11503823f2eb83a66..969bb3403335fc58577a4f5406e1bc963fb567af 100644 --- a/Back_end/src/Entity/FrequenceType.php +++ b/Back_end/src/Entity/FrequenceType.php @@ -3,6 +3,8 @@ namespace App\Entity; use App\Repository\FrequenceTypeRepository; +use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; @@ -23,6 +25,14 @@ class FrequenceType #[ORM\Column(length: 255)] private ?string $nom = null; + #[ORM\OneToMany(mappedBy: 'frequence_type_id', targetEntity: Panier::class)] + private Collection $paniers; + + public function __construct() + { + $this->paniers = new ArrayCollection(); + } + public function getId(): ?int { return $this->id; @@ -63,4 +73,34 @@ class FrequenceType return $this; } + + /** + * @return Collection<int, Panier> + */ + public function getPaniers(): Collection + { + return $this->paniers; + } + + public function addPanier(Panier $panier): static + { + if (!$this->paniers->contains($panier)) { + $this->paniers->add($panier); + $panier->setFrequenceTypeId($this); + } + + return $this; + } + + public function removePanier(Panier $panier): static + { + if ($this->paniers->removeElement($panier)) { + // set the owning side to null (unless already changed) + if ($panier->getFrequenceTypeId() === $this) { + $panier->setFrequenceTypeId(null); + } + } + + return $this; + } } diff --git a/Back_end/src/Entity/Panier.php b/Back_end/src/Entity/Panier.php index 6dce9f853ee464b1fc0e1aa26b55b6c83303a0ad..7efb242dfaaf8113099607710109e369b3498313 100644 --- a/Back_end/src/Entity/Panier.php +++ b/Back_end/src/Entity/Panier.php @@ -23,6 +23,14 @@ class Panier #[ORM\Column(type: Types::TEXT, nullable: true)] private ?string $description = null; + #[ORM\ManyToOne(inversedBy: 'paniers')] + #[ORM\JoinColumn(nullable: false)] + private ?Unite $unite_id = null; + + #[ORM\ManyToOne(inversedBy: 'paniers')] + #[ORM\JoinColumn(nullable: false)] + private ?FrequenceType $frequence_type_id = null; + public function getId(): ?int { return $this->id; @@ -63,4 +71,28 @@ class Panier return $this; } + + public function getUniteId(): ?Unite + { + return $this->unite_id; + } + + public function setUniteId(?Unite $unite_id): static + { + $this->unite_id = $unite_id; + + return $this; + } + + public function getFrequenceTypeId(): ?FrequenceType + { + return $this->frequence_type_id; + } + + public function setFrequenceTypeId(?FrequenceType $frequence_type_id): static + { + $this->frequence_type_id = $frequence_type_id; + + return $this; + } } diff --git a/Back_end/src/Entity/Unite.php b/Back_end/src/Entity/Unite.php index f5b9321dff8a15f25fd49f3bda5d195dae289145..4f00cb3e8e490befbb5dc91b486164402a7b1b25 100644 --- a/Back_end/src/Entity/Unite.php +++ b/Back_end/src/Entity/Unite.php @@ -3,6 +3,8 @@ namespace App\Entity; use App\Repository\UniteRepository; +use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; #[ORM\Entity(repositoryClass: UniteRepository::class)] @@ -19,6 +21,14 @@ class Unite #[ORM\Column] private ?int $nbDecimale = null; + #[ORM\OneToMany(mappedBy: 'unite_id', targetEntity: Panier::class)] + private Collection $paniers; + + public function __construct() + { + $this->paniers = new ArrayCollection(); + } + public function getId(): ?int { return $this->id; @@ -54,4 +64,34 @@ class Unite return $this; } + + /** + * @return Collection<int, Panier> + */ + public function getPaniers(): Collection + { + return $this->paniers; + } + + public function addPanier(Panier $panier): static + { + if (!$this->paniers->contains($panier)) { + $this->paniers->add($panier); + $panier->setUniteId($this); + } + + return $this; + } + + public function removePanier(Panier $panier): static + { + if ($this->paniers->removeElement($panier)) { + // set the owning side to null (unless already changed) + if ($panier->getUniteId() === $this) { + $panier->setUniteId(null); + } + } + + return $this; + } } diff --git a/docker/php/Dockerfile b/docker/php/Dockerfile index 52c01863ba2a62421ae34cbcb62321da47b3529f..5d56c465c0545320b815143d0555fe17ac6414af 100644 --- a/docker/php/Dockerfile +++ b/docker/php/Dockerfile @@ -12,6 +12,4 @@ WORKDIR /var/www/symfony_docker RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer RUN curl -sS https://get.symfony.com/cli/installer | bash -RUN mv /root/.symfony5/bin/symfony /usr/local/bin/symfony - -RUN composer install \ No newline at end of file +RUN mv /root/.symfony5/bin/symfony /usr/local/bin/symfony \ No newline at end of file