src/Entity/FormQuotationTruck.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Interfaces\CRMLead;
  4. use App\Repository\FormQuotationTruckRepository;
  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=FormQuotationTruckRepository::class)
  10.  */
  11. class FormQuotationTruck extends BaseForm implements CRMLead
  12. {
  13.     /**
  14.      * @ORM\Column(type="string")
  15.      * @Assert\Length(max="255")
  16.      * @Assert\NotBlank()
  17.      */
  18.     private $name;
  19.     /**
  20.      * @ORM\Column(type="string")
  21.      * @Assert\Length(max="255")
  22.      * @Assert\NotBlank()
  23.      */
  24.     private $last_name;
  25.     /**
  26.      * @ORM\Column(type="string")
  27.      * @Assert\Length(max="255")
  28.      * @Assert\NotBlank()
  29.      */
  30.     private $document;
  31.     /**
  32.      * @ORM\Column(type="string")
  33.      * @Assert\Length(max="255")
  34.      * @Assert\NotBlank()
  35.      */
  36.     private $company;
  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="string")
  57.      * @Assert\Length(max="255")
  58.      * @Assert\NotBlank()
  59.      */
  60.     private $model;
  61.     /**
  62.      * @ORM\Column(type="string")
  63.      * @Assert\Length(max="255")
  64.      * @Assert\NotBlank()
  65.      */
  66.     private $crm_model;
  67.     /**
  68.      * @ORM\Column(type="string", nullable=true)
  69.      * @Assert\Length(max="255")
  70.      */
  71.     private $subject;
  72.     /**
  73.      * @ORM\Column(type="text", nullable=true)
  74.      */
  75.     private $message;
  76.     /**
  77.      * @ORM\Column(type="json", nullable=true)
  78.      */
  79.     private $crm_body;
  80.     /**
  81.      * @ORM\Column(type="json", nullable=true)
  82.      */
  83.     private $crm_result;
  84.     /**
  85.      * FormQuotationTruck constructor.
  86.      */
  87.     public function __construct()
  88.     {
  89.         parent::__construct();
  90.     }
  91.     public function leadToCRM(): Lead
  92.     {
  93.         $lead = new Lead();
  94.         $model $this->getCrmModel() ?? $this->getModel() ?? null;
  95.         $lead
  96.             ->setModel($model)
  97.             ->setRuc($this->getDocument())
  98.             ->setCompany($this->getCompany())
  99.             ->setName($this->getName())
  100.             ->setLastname($this->getLastName())
  101.             ->setEmail($this->getEmail())
  102.             ->setPhone($this->getPhone())
  103.             ->setDepartment($this->getDepartment())
  104.             ->setMessage($this->getMessage())
  105.             ->setTopic('Cotización')
  106.             ->setCategory('Venta')
  107.             ->setOriginForm('UD Trucks ' $model)
  108.             ->setUtmSource($this->getUtmSource())
  109.             ->setUtmCampaign($this->getUtmCampaign())
  110.             ->setUtmTerm($this->getUtmTerm())
  111.             ->setUtmMedium($this->getUtmMedium());
  112.         return $lead;
  113.     }
  114.     public function getName(): ?string
  115.     {
  116.         return $this->name;
  117.     }
  118.     public function setName(string $name): self
  119.     {
  120.         $this->name $name;
  121.         return $this;
  122.     }
  123.     public function getLastName(): ?string
  124.     {
  125.         return $this->last_name;
  126.     }
  127.     public function setLastName(string $last_name): self
  128.     {
  129.         $this->last_name $last_name;
  130.         return $this;
  131.     }
  132.     public function getDocument(): ?string
  133.     {
  134.         return $this->document;
  135.     }
  136.     public function setDocument(string $document): self
  137.     {
  138.         $this->document $document;
  139.         return $this;
  140.     }
  141.     public function getCompany(): ?string
  142.     {
  143.         return $this->company;
  144.     }
  145.     public function setCompany(string $company): self
  146.     {
  147.         $this->company $company;
  148.         return $this;
  149.     }
  150.     public function getEmail(): ?string
  151.     {
  152.         return $this->email;
  153.     }
  154.     public function setEmail(string $email): self
  155.     {
  156.         $this->email $email;
  157.         return $this;
  158.     }
  159.     public function getPhone(): ?string
  160.     {
  161.         return $this->phone;
  162.     }
  163.     public function setPhone(string $phone): self
  164.     {
  165.         $this->phone $phone;
  166.         return $this;
  167.     }
  168.     public function getDepartment(): ?string
  169.     {
  170.         return $this->department;
  171.     }
  172.     public function setDepartment(string $department): self
  173.     {
  174.         $this->department $department;
  175.         return $this;
  176.     }
  177.     public function getModel(): ?string
  178.     {
  179.         return $this->model;
  180.     }
  181.     public function setModel(string $model): self
  182.     {
  183.         $this->model $model;
  184.         return $this;
  185.     }
  186.     public function getCrmModel(): ?string
  187.     {
  188.         return $this->crm_model;
  189.     }
  190.     public function setCrmModel(string $crm_model): self
  191.     {
  192.         $this->crm_model $crm_model;
  193.         return $this;
  194.     }
  195.     public function getSubject(): ?string
  196.     {
  197.         return $this->subject;
  198.     }
  199.     public function setSubject(?string $subject): self
  200.     {
  201.         $this->subject $subject;
  202.         return $this;
  203.     }
  204.     public function getMessage(): ?string
  205.     {
  206.         return $this->message;
  207.     }
  208.     public function setMessage(?string $message): self
  209.     {
  210.         $this->message $message;
  211.         return $this;
  212.     }
  213.     public function getCrmBody(): ?array
  214.     {
  215.         return $this->crm_body;
  216.     }
  217.     public function setCrmBody(?array $crm_body): self
  218.     {
  219.         $this->crm_body $crm_body;
  220.         return $this;
  221.     }
  222.     public function getCrmResult(): ?array
  223.     {
  224.         return $this->crm_result;
  225.     }
  226.     public function setCrmResult(?array $crm_result): self
  227.     {
  228.         $this->crm_result $crm_result;
  229.         return $this;
  230.     }
  231. }