<?php
namespace App\Entity;
use App\Repository\CustomerAdvertisingAreaTierPositionRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: CustomerAdvertisingAreaTierPositionRepository::class)]
class CustomerAdvertisingAreaTierPosition
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToOne(targetEntity: 'App\Entity\Customer')]
#[ORM\JoinColumn(name: 'fk_customer', nullable: false)]
private Customer $customer;
#[ORM\ManyToOne(targetEntity: 'App\Entity\CustomerPackage', inversedBy: 'customerAdvertisingAreaTierPosition')]
#[ORM\JoinColumn(name: 'fk_customer_package', nullable: false)]
private CustomerPackage $customerPackage;
#[ORM\ManyToOne(targetEntity: 'App\Entity\AdvertisingAreaTier')]
#[ORM\JoinColumn(name: 'fk_advertising_area_tier', nullable: false)]
private AdvertisingAreaTier $advertisingAreaTier;
#[ORM\ManyToOne(targetEntity: 'App\Entity\AdvertisingAreaTierPosition')]
#[ORM\JoinColumn(name: 'fk_advertising_area_tier_position', nullable: false)]
private AdvertisingAreaTierPosition $advertisingAreaTierPosition;
#[ORM\OneToMany(
mappedBy: 'customerAdvertisingAreaTierPosition',
targetEntity: CustomerAdvertisingArea::class,
cascade: ['persist', 'remove']
)]
private Collection $customerAdvertisingAreas;
public function __construct()
{
$this->customerAdvertisingAreas = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getCustomer(): ?Customer
{
return $this->customer;
}
public function setCustomer(?Customer $customer): self
{
$this->customer = $customer;
return $this;
}
public function getCustomerPackage(): ?CustomerPackage
{
return $this->customerPackage;
}
public function setCustomerPackage(?CustomerPackage $customerPackage): self
{
$this->customerPackage = $customerPackage;
return $this;
}
public function getAdvertisingAreaTier(): ?AdvertisingAreaTier
{
return $this->advertisingAreaTier;
}
public function setAdvertisingAreaTier(?AdvertisingAreaTier $advertisingAreaTier): self
{
$this->advertisingAreaTier = $advertisingAreaTier;
return $this;
}
public function getAdvertisingAreaTierPosition(): ?AdvertisingAreaTierPosition
{
return $this->advertisingAreaTierPosition;
}
public function setAdvertisingAreaTierPosition(?AdvertisingAreaTierPosition $advertisingAreaTierPosition): self
{
$this->advertisingAreaTierPosition = $advertisingAreaTierPosition;
return $this;
}
/**
* @return Collection<int, CustomerAdvertisingArea>
*/
public function getCustomerAdvertisingAreas(): Collection
{
return $this->customerAdvertisingAreas;
}
public function addCustomerAdvertisingArea(CustomerAdvertisingArea $customerAdvertisingArea): self
{
if (!$this->customerAdvertisingAreas->contains($customerAdvertisingArea)) {
$this->customerAdvertisingAreas->add($customerAdvertisingArea);
$customerAdvertisingArea->setCustomerAdvertisingAreaTierPosition($this);
}
return $this;
}
public function removeCustomerAdvertisingArea(CustomerAdvertisingArea $customerAdvertisingArea): self
{
if ($this->customerAdvertisingAreas->removeElement($customerAdvertisingArea)) {
// set the owning side to null (unless already changed)
if ($customerAdvertisingArea->getCustomerAdvertisingAreaTierPosition() === $this) {
$customerAdvertisingArea->setCustomerAdvertisingAreaTierPosition(null);
}
}
return $this;
}
}