<?phpnamespace App\Entity;use App\Repository\FormeRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use phpDocumentor\Reflection\Types\Integer;#[ORM\Entity(repositoryClass: FormeRepository::class)]class Forme{ //Déclarations des variables #[ORM\Id] #[ORM\Column(name: 'id_forme',type: 'integer', nullable: false)] //Spécifie que la valeur générée est un ID auto-incrémenté #[ORM\GeneratedValue(strategy:'IDENTITY')] private ?int $id; #[ORM\Column(length: 255, nullable: false)] private ?string $nom = null; //Association #[ORM\OneToMany(mappedBy:'forme', targetEntity: Model::class, orphanRemoval: true)] private Collection $models; #[ORM\ManyToOne(targetEntity: TypeCollection::class, inversedBy: 'formes')] #[ORM\JoinColumn(referencedColumnName: 'id_type_collection', nullable: false)] private ?TypeCollection $typeCollection = null; //Constructeur public function __construct() { $this->models = new ArrayCollection(); } //Getters et Setters /** * @return int|null */ public function getId(): ?int { return $this->id; } /** * @return string|null */ public function getNom(): ?string { return $this->nom; } /** * @param string|null $nom */ public function setNom(?string $nom): void { $this->nom = $nom; } //Fonctions collections /** * @return Collection<int, Model> */ public function getModels(): Collection { return $this->models; } public function addModel(Model $model): self { if (!$this->models->contains($model)) { $this->models->add($model); $model->addForme($this); } return $this; } public function removeModel(Model $model): self { if ($this->models->removeElement($model)) { // set the owning side to null (unless already changed) if ($model->getForme() === $this) { $model->addForme(null); } } return $this; } public function getTypeCollection(): ?TypeCollection { return $this->typeCollection; } public function setTypeCollection(?TypeCollection $typeCollection): self { $this->typeCollection = $typeCollection; return $this; } public function __toString(): string { return $this->nom; }}