<?phpnamespace App\Entity\Website;use App\Entity\Generic\Customer\Customer;use App\Entity\Website\Website\Website;use App\Repository\Website\CampaignRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;use App\Entity\BaseEntity;#[ORM\Entity(repositoryClass: CampaignRepository::class)]class Campaign extends BaseEntity{ #[ORM\Id] #[ORM\GeneratedValue(strategy: 'CUSTOM')] #[ORM\CustomIdGenerator(class: UuidGenerator::class)] #[ORM\Column(type: 'guid', unique: true)] private ?string $id = null; #[ORM\Column(length: 255)] private ?string $slug = null; #[ORM\Column(length: 255)] private ?string $name = null; #[ORM\Column(nullable: true)] private ?int $count = null; #[ORM\Column(nullable: true)] private ?int $views = null; #[ORM\OneToMany(mappedBy: 'campaign', targetEntity: Customer::class)] private Collection $customers; #[ORM\ManyToOne(inversedBy: 'campaigns')] #[ORM\JoinColumn(nullable: false)] private ?Website $website = null; public function __construct() { parent::__construct(); $this->customers = new ArrayCollection(); } public function __toString() { return $this->getName(); } public function getId(): ?string { return $this->id; } public function getSlug(): ?string { return $this->slug; } public function setSlug(string $slug): static { $this->slug = $slug; return $this; } public function getName(): ?string { return $this->name; } public function setName(string $name): static { $this->name = $name; return $this; } public function getCount(): ?int { return count($this->getUsers()); } public function setCount(?int $count): static { $this->count = $count; return $this; } public function getViews(): ?int { return $this->views; } public function setViews(?int $views): static { $this->views = $views; return $this; } /** * @return Collection<int, Customer> */ public function getCustomers(): Collection { return $this->customers; } public function addCustomer(Customer $customer): static { if (!$this->customers->contains($customer)) { $this->customers->add($customer); $customer->setCampaign($this); } return $this; } public function removeCustomer(Customer $customer): static { if ($this->customers->removeElement($customer)) { // set the owning side to null (unless already changed) if ($customer->getCampaign() === $this) { $customer->setCampaign(null); } } return $this; } public function getWebsite(): ?Website { return $this->website; } public function setWebsite(?Website $website): static { $this->website = $website; return $this; }}