src/Entity/AdMapping.php line 13
<?phpnamespace App\Entity;use App\Repository\AdMappingRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Gedmo\Timestampable\Traits\TimestampableEntity;#[ORM\Entity(repositoryClass: AdMappingRepository::class)]#[ORM\UniqueConstraint(name: 'unique_user', columns: ['user_id'])]class AdMapping{use TimestampableEntity;#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\ManyToOne(inversedBy: 'adMappings')]private ?User $user = null;#[ORM\OneToMany(mappedBy: 'adMapping', targetEntity: AdMappingCustomer::class, cascade: ['all'])]private Collection $adMappingCustomers;public function __construct(){$this->adMappingCustomers = new ArrayCollection();}public function getId(): ?int{return $this->id;}public function getUser(): ?User{return $this->user;}public function setUser(?User $user): static{$this->user = $user;return $this;}/*** @return Collection<int, AdMappingCustomer>*/public function getAdMappingCustomers(): Collection{return $this->adMappingCustomers;}public function addAdMappingCustomer(AdMappingCustomer $adMappingCustomer): static{if (!$this->adMappingCustomers->contains($adMappingCustomer)) {$this->adMappingCustomers->add($adMappingCustomer);$adMappingCustomer->setAdMapping($this);}return $this;}public function removeAdMappingCustomer(AdMappingCustomer $adMappingCustomer): static{if ($this->adMappingCustomers->removeElement($adMappingCustomer)) {// set the owning side to null (unless already changed)if ($adMappingCustomer->getAdMapping() === $this) {$adMappingCustomer->setAdMapping(null);}}return $this;}public function getTotalCustomers(){return $this->adMappingCustomers->count();}public function __toString(){return (string)$this->getUser();}}