<?php
namespace App\Entity;
use App\Repository\InfoTypeRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: InfoTypeRepository::class)]
class InfoType
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
#[ORM\OneToMany(mappedBy: 'info_type', targetEntity: CustomerInfoType::class)]
private Collection $customerInfoTypes;
public function __construct()
{
$this->customerInfoTypes = 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, CustomerInfoType>
*/
public function getCustomerInfoTypes(): Collection
{
return $this->customerInfoTypes;
}
public function addCustomerInfoType(CustomerInfoType $customerInfoType): self
{
if (!$this->customerInfoTypes->contains($customerInfoType)) {
$this->customerInfoTypes->add($customerInfoType);
$customerInfoType->setInfoType($this);
}
return $this;
}
public function removeCustomerInfoType(CustomerInfoType $customerInfoType): self
{
if ($this->customerInfoTypes->removeElement($customerInfoType)) {
// set the owning side to null (unless already changed)
if ($customerInfoType->getInfoType() === $this) {
$customerInfoType->setInfoType(null);
}
}
return $this;
}
}