src/Entity/ProspectOnStoreQualification.php line 24

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Enum\QualificationServiceEnum;
  4. use App\Repository\ProspectOnStoreQualificationRepository;
  5. use App\Entity\Enum\QualificationStateEnum;
  6. use DateTimeInterface;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Gedmo\Mapping\Annotation as Gedmo;
  9. use ApiPlatform\Core\Annotation\ApiResource;
  10. use Symfony\Component\Serializer\Annotation\Groups;
  11. /**
  12.  * @ORM\Entity(repositoryClass=ProspectOnStoreQualificationRepository::class)
  13.  * @ORM\EntityListeners({"App\Listener\ProspectOnStoreQualificationListener"})
  14.  *
  15.  * @ApiResource(
  16.  *      itemOperations={"get"},
  17.  *      normalizationContext={"groups"={"posq:read"}},
  18.  *      denormalizationContext={"groups"={"posq:write"}}
  19.  *  )
  20.  */
  21. class ProspectOnStoreQualification
  22. {
  23.     /**
  24.      * @ORM\Id()
  25.      * @ORM\GeneratedValue()
  26.      * @ORM\Column(type="integer")
  27.      * @Groups({"posq:read"})
  28.      *
  29.      */
  30.     private $id;
  31.     /**
  32.      * @ORM\Column(type="string", length=5)
  33.      * @Groups({"posq:read","pos:read"})
  34.      */
  35.     private $state;
  36.     /**
  37.      * @ORM\Column(type="datetime")
  38.      * @Gedmo\Timestampable(on="create")
  39.      */
  40.     private $updatedAt;
  41.     /**
  42.      * @ORM\Column(type="datetime", nullable=true)
  43.      */
  44.     private $endedAt;
  45.     /**
  46.      * Validation date
  47.      * @ORM\Column(type="datetime", nullable=true)
  48.      */
  49.     private $validatedAt;
  50.     /**
  51.      * @ORM\OneToOne(targetEntity=ProspectOnStore::class, mappedBy="qualification")
  52.      */
  53.     private ProspectOnStore $prospectOnStore;
  54.     /**
  55.      * @ORM\Column(type="datetime", nullable=true)
  56.      */
  57.     private $mediaoptinTransmissionDate;
  58.     /**
  59.      * @ORM\Column(type="boolean", nullable=true)
  60.      */
  61.     private $mediaoptinTransmissionStatus;
  62.     /**
  63.      * @ORM\Column(type="string", length=255, nullable=true)
  64.      */
  65.     private $mediaoptinTransmissionError;
  66.     /**
  67.      * @ORM\Column(type="text", nullable=true)
  68.      */
  69.     private $comment;
  70.     /**
  71.      * @ORM\Column(type="string", length=5)
  72.      */
  73.     private string $service;
  74.     public function __construct(ProspectOnStore $prospectOnStore)
  75.     {
  76.         $this->state QualificationStateEnum::PENDING;
  77.         $this->service QualificationServiceEnum::HUBSPOT;
  78.         $this->prospectOnStore $prospectOnStore;
  79.     }
  80.     public function getId(): ?int
  81.     {
  82.         return $this->id;
  83.     }
  84.     public function getState(): ?string
  85.     {
  86.         return $this->state;
  87.     }
  88.     public function setState(string $state): self
  89.     {
  90.         $this->state $state;
  91.         return $this;
  92.     }
  93.     public function isValidated(): bool
  94.     {
  95.         return $this->state == QualificationStateEnum::VALID;
  96.     }
  97.     public function isPending(): bool
  98.     {
  99.         return $this->state == QualificationStateEnum::PENDING;
  100.     }
  101.     public function getStateLabel(): ?string
  102.     {
  103.         return QualificationStateEnum::getStateName($this->state);
  104.     }
  105.     public function getUpdatedAt(): ?DateTimeInterface
  106.     {
  107.         return $this->updatedAt;
  108.     }
  109.     public function setUpdatedAt(DateTimeInterface $updatedAt): self
  110.     {
  111.         $this->updatedAt $updatedAt;
  112.         return $this;
  113.     }
  114.     /**
  115.      * @return ProspectOnStore
  116.      */
  117.     public function getProspectOnStore(): ProspectOnStore
  118.     {
  119.         return $this->prospectOnStore;
  120.     }
  121.     /**
  122.      * @param ProspectOnStore $prospectOnStore
  123.      */
  124.     public function setProspectOnStore(ProspectOnStore $prospectOnStore): void
  125.     {
  126.         $this->prospectOnStore $prospectOnStore;
  127.     }
  128.     /**
  129.      * shortcut
  130.      * @return Prospect
  131.      */
  132.     public function getProspect(): Prospect
  133.     {
  134.         return $this->prospectOnStore->getProspect();
  135.     }
  136.     /**
  137.      * shortcut
  138.      * @return Store
  139.      */
  140.     public function getStore(): Store
  141.     {
  142.         return $this->prospectOnStore->getStore();
  143.     }
  144.     public function getServiceTransmissionDate(): ?DateTimeInterface
  145.     {
  146.         return $this->mediaoptinTransmissionDate;
  147.     }
  148.     public function setServiceTransmissionDate(?DateTimeInterface $serviceTransmissionDate): self
  149.     {
  150.         $this->mediaoptinTransmissionDate $serviceTransmissionDate;
  151.         return $this;
  152.     }
  153.     public function getServiceTransmissionStatus(): ?bool
  154.     {
  155.         return $this->mediaoptinTransmissionStatus;
  156.     }
  157.     public function setServiceTransmissionStatus(?bool $serviceTransmissionStatus): self
  158.     {
  159.         $this->mediaoptinTransmissionStatus $serviceTransmissionStatus;
  160.         return $this;
  161.     }
  162.     public function getServiceTransmissionError(): ?string
  163.     {
  164.         return $this->mediaoptinTransmissionError;
  165.     }
  166.     public function setServiceTransmissionError(?string $serviceTransmissionError): self
  167.     {
  168.         $this->mediaoptinTransmissionError $serviceTransmissionError;
  169.         return $this;
  170.     }
  171.     public function getValidatedAt(): ?DateTimeInterface
  172.     {
  173.         return $this->validatedAt;
  174.     }
  175.     public function setValidatedAt(?DateTimeInterface $validatedAt): self
  176.     {
  177.         $this->validatedAt $validatedAt;
  178.         return $this;
  179.     }
  180.     public function getComment(): ?string
  181.     {
  182.         return $this->comment;
  183.     }
  184.     public function setComment(?string $comment): self
  185.     {
  186.         $this->comment $comment;
  187.         return $this;
  188.     }
  189.     /**
  190.      * @return mixed
  191.      */
  192.     public function getEndedAt()
  193.     {
  194.         return $this->endedAt;
  195.     }
  196.     /**
  197.      * @param mixed $endedAt
  198.      */
  199.     public function setEndedAt($endedAt): void
  200.     {
  201.         $this->endedAt $endedAt;
  202.     }
  203.     public function getService(): ?string
  204.     {
  205.         return $this->service;
  206.     }
  207.     public function setService(string $service): self
  208.     {
  209.         $this->service $service;
  210.         return $this;
  211.     }
  212.     public function isServiceHubspot(): bool
  213.     {
  214.         return $this->service == QualificationServiceEnum::HUBSPOT;
  215.     }
  216.     public function isServiceMediaoptin(): bool
  217.     {
  218.         return $this->service == QualificationServiceEnum::MEDIAOPTIN;
  219.     }
  220.     public function getServiceLabel(): ?string
  221.     {
  222.         return QualificationServiceEnum::getServiceName($this->service);
  223.     }
  224. }