src/Entity/AdMappingCustomer.php line 12

  1. <?php
  2. namespace App\Entity;
  3. use App\Enum\CustomerClass;
  4. use App\Repository\AdMappingCustomerRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Gedmo\Timestampable\Traits\TimestampableEntity;
  7. #[ORM\Entity(repositoryClassAdMappingCustomerRepository::class)]
  8. #[ORM\UniqueConstraint(name'unique_admapping_customer_class_dates'columns: ['ad_mapping_id''customer_id''class''effective_start_date''effective_end_date'])]
  9. class AdMappingCustomer
  10. {
  11.     use TimestampableEntity;
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column]
  15.     private ?int $id null;
  16.     #[ORM\ManyToOne(inversedBy'adMappingCustomers')]
  17.     private ?AdMapping $adMapping null;
  18.     #[ORM\Column(length255nullabletrue)]
  19.     private ?string $customer_id null;
  20.     #[ORM\Column(enumTypeCustomerClass::class, nullabletrue)]
  21.     private ?CustomerClass $class null;
  22.     #[ORM\Column(type'date'nullabletrue)]
  23.     private ?\DateTimeInterface $effectiveStartDate null;
  24.     #[ORM\Column(type'date'nullabletrue)]
  25.     private ?\DateTimeInterface $effectiveEndDate null;
  26.     public function getId(): ?int
  27.     {
  28.         return $this->id;
  29.     }
  30.     public function getAdMapping(): ?AdMapping
  31.     {
  32.         return $this->adMapping;
  33.     }
  34.     public function setAdMapping(?AdMapping $adMapping): static
  35.     {
  36.         $this->adMapping $adMapping;
  37.         return $this;
  38.     }
  39.     public function getCustomerId(): ?string
  40.     {
  41.         return $this->customer_id;
  42.     }
  43.     public function setCustomerId(?string $customer_id): static
  44.     {
  45.         $this->customer_id $customer_id;
  46.         return $this;
  47.     }
  48.     public function getClass(): ?CustomerClass
  49.     {
  50.         return $this->class;
  51.     }
  52.     public function setClass(?CustomerClass $class): static
  53.     {
  54.         $this->class $class;
  55.         return $this;
  56.     }
  57.     public function getEffectiveStartDate(): ?\DateTimeInterface
  58.     {
  59.         return $this->effectiveStartDate;
  60.     }
  61.     public function setEffectiveStartDate(?\DateTimeInterface $effectiveStartDate): static
  62.     {
  63.         $this->effectiveStartDate $effectiveStartDate;
  64.         return $this;
  65.     }
  66.     public function getEffectiveEndDate(): ?\DateTimeInterface
  67.     {
  68.         return $this->effectiveEndDate;
  69.     }
  70.     public function setEffectiveEndDate(?\DateTimeInterface $effectiveEndDate): static
  71.     {
  72.         $this->effectiveEndDate $effectiveEndDate;
  73.         return $this;
  74.     }
  75.     //to string
  76.     public function __toString()
  77.     {
  78.         return (string)$this->getCustomerId();
  79.     }
  80. }