← Back
Editing: ControlTemplate.php
<?php namespace App\Entity; use App\Repository\ControlTemplateRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; #[ORM\Entity(repositoryClass: ControlTemplateRepository::class)] class ControlTemplate { #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column(type: 'integer')] #[Groups(['show_control_template', 'show_address', 'show_control'])] private ?int $id = null; #[ORM\Column(type: 'string', length: 255)] #[Groups(['show_control_template', 'show_address'])] private string $name = ''; #[ORM\ManyToMany(targetEntity: Adresse::class, inversedBy: 'controlTemplates')] #[Groups(['show_control_template'])] private Collection $adresses; #[ORM\ManyToMany(targetEntity: Item::class, inversedBy: 'controlTemplates')] #[Groups(['show_control_template', 'show_address', 'show_control'])] private Collection $items; public function __construct() { $this->adresses = new ArrayCollection(); $this->items = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getName(): ?string { return $this->name; } public function setName(string $name): self { $this->name = $name; return $this; } /** * @return Collection<int, Adresse> */ public function getAdresses(): Collection { return $this->adresses; } public function addAdress(Adresse $adress): self { if (!$this->adresses->contains($adress)) { $this->adresses[] = $adress; } return $this; } public function removeAdress(Adresse $adress): self { $this->adresses->removeElement($adress); return $this; } /** * @return Collection<int, Item> */ public function getItems(): Collection { return $this->items; } public function addItem(Item $item): self { if (!$this->items->contains($item)) { $this->items[] = $item; } return $this; } public function removeItem(Item $item): self { $this->items->removeElement($item); return $this; } }
Save File
Cancel