Ajout organistion Id au Actions

This commit is contained in:
Charles 2025-08-04 10:57:05 +02:00
parent 1e8d5e1eaf
commit 6670fbc8b8
1 changed files with 37 additions and 0 deletions

View File

@ -45,9 +45,16 @@ class Organizations
#[ORM\Column(length: 255, nullable: true)]
private ?string $name = null;
/**
* @var Collection<int, Actions>
*/
#[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<int, Actions>
*/
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;
}
}