<?php
namespace App\Entity;
use App\Repository\TypologieStructureRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=TypologieStructureRepository::class)
* @ORM\Table(name="co_typologie_structure")
*/
class TypologieStructure
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\OneToMany(targetEntity=Contact::class, mappedBy="typologieStructure")
*/
private $contact;
public function __construct()
{
$this->contact = 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, Contact>
*/
public function getContact(): Collection
{
return $this->contact;
}
public function addContact(Contact $contact): self
{
if (!$this->contact->contains($contact)) {
$this->contact[] = $contact;
$contact->setTypologieStructure($this);
}
return $this;
}
public function removeContact(Contact $contact): self
{
if ($this->contact->removeElement($contact)) {
// set the owning side to null (unless already changed)
if ($contact->getTypologieStructure() === $this) {
$contact->setTypologieStructure(null);
}
}
return $this;
}
}