src/Entity/FormQuotation.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Interfaces\CRMLead;
  4. use App\Repository\FormQuotationRepository;
  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=FormQuotationRepository::class)
  10.  */
  11. class FormQuotation 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="text", nullable=true)
  69.      */
  70.     private $message;
  71.     /**
  72.      * @ORM\Column(type="json", nullable=true)
  73.      */
  74.     private $crm_body;
  75.     /**
  76.      * @ORM\Column(type="json", nullable=true)
  77.      */
  78.     private $crm_result;
  79.     /**
  80.      * FormQuotation constructor.
  81.      */
  82.     public function __construct()
  83.     {
  84.         parent::__construct();
  85.     }
  86.     public function leadToCRM(): Lead
  87.     {
  88.         $lead = new Lead();
  89.         $model $this->getCrmModel() ?? $this->getModel() ?? null;
  90.         $lead
  91.             ->setModel($model)
  92.             ->setRuc($this->getDocument())
  93.             ->setCompany($this->getCompany())
  94.             ->setName($this->getName())
  95.             ->setLastname($this->getLastName())
  96.             ->setEmail($this->getEmail())
  97.             ->setPhone($this->getPhone())
  98.             ->setDepartment($this->getDepartment())
  99.             ->setMessage($this->getMessage())
  100.             ->setTopic('Venta')
  101.             ->setCategory('Venta')
  102.             ->setOriginForm('UD Trucks Cotizacion')
  103.             ->setUtmSource($this->getUtmSource())
  104.             ->setUtmCampaign($this->getUtmCampaign())
  105.             ->setUtmTerm($this->getUtmTerm())
  106.             ->setUtmMedium($this->getUtmMedium());
  107.         return $lead;
  108.     }
  109.     public function getName(): ?string
  110.     {
  111.         return $this->name;
  112.     }
  113.     public function setName(string $name): self
  114.     {
  115.         $this->name $name;
  116.         return $this;
  117.     }
  118.     public function getLastName(): ?string
  119.     {
  120.         return $this->last_name;
  121.     }
  122.     public function setLastName(string $last_name): self
  123.     {
  124.         $this->last_name $last_name;
  125.         return $this;
  126.     }
  127.     public function getDocument(): ?string
  128.     {
  129.         return $this->document;
  130.     }
  131.     public function setDocument(string $document): self
  132.     {
  133.         $this->document $document;
  134.         return $this;
  135.     }
  136.     public function getCompany(): ?string
  137.     {
  138.         return $this->company;
  139.     }
  140.     public function setCompany(string $company): self
  141.     {
  142.         $this->company $company;
  143.         return $this;
  144.     }
  145.     public function getEmail(): ?string
  146.     {
  147.         return $this->email;
  148.     }
  149.     public function setEmail(string $email): self
  150.     {
  151.         $this->email $email;
  152.         return $this;
  153.     }
  154.     public function getPhone(): ?string
  155.     {
  156.         return $this->phone;
  157.     }
  158.     public function setPhone(string $phone): self
  159.     {
  160.         $this->phone $phone;
  161.         return $this;
  162.     }
  163.     public function getDepartment(): ?string
  164.     {
  165.         return $this->department;
  166.     }
  167.     public function setDepartment(string $department): self
  168.     {
  169.         $this->department $department;
  170.         return $this;
  171.     }
  172.     public function getModel(): ?string
  173.     {
  174.         return $this->model;
  175.     }
  176.     public function setModel(string $model): self
  177.     {
  178.         $this->model $model;
  179.         return $this;
  180.     }
  181.     public function getCrmModel(): ?string
  182.     {
  183.         return $this->crm_model;
  184.     }
  185.     public function setCrmModel(string $crm_model): self
  186.     {
  187.         $this->crm_model $crm_model;
  188.         return $this;
  189.     }
  190.     public function getMessage(): ?string
  191.     {
  192.         return $this->message;
  193.     }
  194.     public function setMessage(?string $message): self
  195.     {
  196.         $this->message $message;
  197.         return $this;
  198.     }
  199.     public function getCrmBody(): ?array
  200.     {
  201.         return $this->crm_body;
  202.     }
  203.     public function setCrmBody(?array $crm_body): self
  204.     {
  205.         $this->crm_body $crm_body;
  206.         return $this;
  207.     }
  208.     public function getCrmResult(): ?array
  209.     {
  210.         return $this->crm_result;
  211.     }
  212.     public function setCrmResult(?array $crm_result): self
  213.     {
  214.         $this->crm_result $crm_result;
  215.         return $this;
  216.     }
  217. }