From 6670fbc8b8566822e140f212a50106509a369843 Mon Sep 17 00:00:00 2001 From: Charles Date: Mon, 4 Aug 2025 10:57:05 +0200 Subject: [PATCH] Ajout organistion Id au Actions --- src/Entity/Organizations.php | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/Entity/Organizations.php b/src/Entity/Organizations.php index 967e388..bdfd0b4 100644 --- a/src/Entity/Organizations.php +++ b/src/Entity/Organizations.php @@ -45,9 +45,16 @@ class Organizations #[ORM\Column(length: 255, nullable: true)] private ?string $name = null; + /** + * @var Collection + */ + #[ORM\OneToMany(targetEntity: Actions::class, mappedBy: 'Organization')] + private Collection $actions; + public function __construct() { $this->apps = new ArrayCollection(); + $this->actions = new ArrayCollection(); } public function getId(): ?int @@ -177,4 +184,34 @@ class Organizations return $this; } + + /** + * @return Collection + */ + public function getActions(): Collection + { + return $this->actions; + } + + public function addAction(Actions $action): static + { + if (!$this->actions->contains($action)) { + $this->actions->add($action); + $action->setOrganization($this); + } + + return $this; + } + + public function removeAction(Actions $action): static + { + if ($this->actions->removeElement($action)) { + // set the owning side to null (unless already changed) + if ($action->getOrganization() === $this) { + $action->setOrganization(null); + } + } + + return $this; + } }