src/Entity/FormAfterSales.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Interfaces\CRMLead;
  4. use App\Repository\FormAfterSalesRepository;
  5. use App\Service\CRM\Lead;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. /**
  9.  * @ORM\Entity(repositoryClass=FormAfterSalesRepository::class)
  10.  */
  11. class FormAfterSales extends BaseForm implements CRMLead
  12. {
  13.     /**
  14.      * @ORM\Column(type="string")
  15.      * @Assert\Length(max="255")
  16.      * @Assert\NotBlank()
  17.      */
  18.     private $document;
  19.     /**
  20.      * @ORM\Column(type="string")
  21.      * @Assert\Length(max="255")
  22.      * @Assert\NotBlank()
  23.      */
  24.     private $company;
  25.     /**
  26.      * @ORM\Column(type="string")
  27.      * @Assert\Length(max="255")
  28.      * @Assert\NotBlank()
  29.      */
  30.     private $name;
  31.     /**
  32.      * @ORM\Column(type="string")
  33.      * @Assert\Length(max="255")
  34.      * @Assert\NotBlank()
  35.      */
  36.     private $last_name;
  37.     /**
  38.      * @ORM\Column(type="string")
  39.      * @Assert\Length(max="255")
  40.      * @Assert\NotBlank()
  41.      */
  42.     private $email;
  43.     /**
  44.      * @ORM\Column(type="string")
  45.      * @Assert\Length(max="255")
  46.      * @Assert\NotBlank()
  47.      */
  48.     private $phone;
  49.     /**
  50.      * @ORM\Column(type="string")
  51.      * @Assert\Length(max="255")
  52.      * @Assert\NotBlank()
  53.      */
  54.     private $department;
  55.     /**
  56.      * @ORM\Column(type="json", nullable=true)
  57.      */
  58.     private $crm_body;
  59.     /**
  60.      * @ORM\Column(type="json", nullable=true)
  61.      */
  62.     private $crm_result;
  63.     /**
  64.      * FormAfterSales constructor.
  65.      */
  66.     public function __construct()
  67.     {
  68.         parent::__construct();
  69.     }
  70.     public function getModel(): ?string
  71.     {
  72.         return null;
  73.     }
  74.     public function getCrmModel(): ?string
  75.     {
  76.         return null;
  77.     }
  78.     public function leadToCRM(): Lead
  79.     {
  80.         $lead = new Lead();
  81.         $lead
  82.             ->setDocumentNumber($this->getDocument())
  83.             ->setCompany($this->getCompany())
  84.             ->setName($this->getName())
  85.             ->setLastname($this->getLastName())
  86.             ->setEmail($this->getEmail())
  87.             ->setPhone($this->getPhone())
  88.             ->setDepartment($this->getDepartment())
  89.             ->setTopic('Cotización')
  90.             ->setCategory('Repuesto')
  91.             ->setOriginForm('UD Trucks Repuestos')
  92.             ->setUtmSource($this->getUtmSource())
  93.             ->setUtmCampaign($this->getUtmCampaign())
  94.             ->setUtmTerm($this->getUtmTerm())
  95.             ->setUtmMedium($this->getUtmMedium());
  96.         return $lead;
  97.     }
  98.     public function getDocument(): ?string
  99.     {
  100.         return $this->document;
  101.     }
  102.     public function setDocument(string $document): self
  103.     {
  104.         $this->document $document;
  105.         return $this;
  106.     }
  107.     public function getCompany(): ?string
  108.     {
  109.         return $this->company;
  110.     }
  111.     public function setCompany(string $company): self
  112.     {
  113.         $this->company $company;
  114.         return $this;
  115.     }
  116.     public function getName(): ?string
  117.     {
  118.         return $this->name;
  119.     }
  120.     public function setName(string $name): self
  121.     {
  122.         $this->name $name;
  123.         return $this;
  124.     }
  125.     public function getLastName(): ?string
  126.     {
  127.         return $this->last_name;
  128.     }
  129.     public function setLastName(string $last_name): self
  130.     {
  131.         $this->last_name $last_name;
  132.         return $this;
  133.     }
  134.     public function getEmail(): ?string
  135.     {
  136.         return $this->email;
  137.     }
  138.     public function setEmail(string $email): self
  139.     {
  140.         $this->email $email;
  141.         return $this;
  142.     }
  143.     public function getPhone(): ?string
  144.     {
  145.         return $this->phone;
  146.     }
  147.     public function setPhone(string $phone): self
  148.     {
  149.         $this->phone $phone;
  150.         return $this;
  151.     }
  152.     public function getDepartment(): ?string
  153.     {
  154.         return $this->department;
  155.     }
  156.     public function setDepartment(string $department): self
  157.     {
  158.         $this->department $department;
  159.         return $this;
  160.     }
  161.     public function getCrmBody(): ?array
  162.     {
  163.         return $this->crm_body;
  164.     }
  165.     public function setCrmBody(?array $crm_body): self
  166.     {
  167.         $this->crm_body $crm_body;
  168.         return $this;
  169.     }
  170.     public function getCrmResult(): ?array
  171.     {
  172.         return $this->crm_result;
  173.     }
  174.     public function setCrmResult(?array $crm_result): self
  175.     {
  176.         $this->crm_result $crm_result;
  177.         return $this;
  178.     }
  179. }