src/Entity/FormContact.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Interfaces\CRMLead;
  4. use App\Repository\FormContactRepository;
  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=FormContactRepository::class)
  10.  */
  11. class FormContact extends BaseForm implements CRMLead
  12. {
  13.     /**
  14.      * @ORM\Column(type="string")
  15.      * @Assert\Length(max="255")
  16.      * @Assert\NotBlank()
  17.      */
  18.     private $company;
  19.     /**
  20.      * @ORM\Column(type="string")
  21.      * @Assert\Length(max="255")
  22.      * @Assert\NotBlank()
  23.      */
  24.     private $name;
  25.     /**
  26.      * @ORM\Column(type="string")
  27.      * @Assert\Length(max="255")
  28.      * @Assert\NotBlank()
  29.      */
  30.     private $last_name;
  31.     /**
  32.      * @ORM\Column(type="string")
  33.      * @Assert\Length(max="255")
  34.      * @Assert\NotBlank()
  35.      */
  36.     private $email;
  37.     /**
  38.      * @ORM\Column(type="string")
  39.      * @Assert\Length(max="255")
  40.      * @Assert\NotBlank()
  41.      */
  42.     private $phone;
  43.     /**
  44.      * @ORM\Column(type="text", nullable=true)
  45.      */
  46.     private $message;
  47.     /**
  48.      * @ORM\Column(type="json", nullable=true)
  49.      */
  50.     private $crm_body;
  51.     /**
  52.      * @ORM\Column(type="json", nullable=true)
  53.      */
  54.     private $crm_result;
  55.     /**
  56.      * FormContact constructor.
  57.      */
  58.     public function __construct()
  59.     {
  60.         parent::__construct();
  61.     }
  62.     public function getDocument(): ?string
  63.     {
  64.         return null;
  65.     }
  66.     public function getDepartment(): ?string
  67.     {
  68.         return null;
  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.             ->setCompany($this->getCompany())
  83.             ->setName($this->getName())
  84.             ->setLastname($this->getLastName())
  85.             ->setEmail($this->getEmail())
  86.             ->setPhone($this->getPhone())
  87.             ->setMessage($this->getMessage())
  88.             ->setTopic('Venta')
  89.             ->setCategory('Venta')
  90.             ->setOriginForm('UD Trucks Cotizacion')
  91.             ->setUtmSource($this->getUtmSource())
  92.             ->setUtmCampaign($this->getUtmCampaign())
  93.             ->setUtmTerm($this->getUtmTerm())
  94.             ->setUtmMedium($this->getUtmMedium());
  95.         return $lead;
  96.     }
  97.     public function getCompany(): ?string
  98.     {
  99.         return $this->company;
  100.     }
  101.     public function setCompany(string $company): self
  102.     {
  103.         $this->company $company;
  104.         return $this;
  105.     }
  106.     public function getName(): ?string
  107.     {
  108.         return $this->name;
  109.     }
  110.     public function setName(string $name): self
  111.     {
  112.         $this->name $name;
  113.         return $this;
  114.     }
  115.     public function getLastName(): ?string
  116.     {
  117.         return $this->last_name;
  118.     }
  119.     public function setLastName(string $last_name): self
  120.     {
  121.         $this->last_name $last_name;
  122.         return $this;
  123.     }
  124.     public function getEmail(): ?string
  125.     {
  126.         return $this->email;
  127.     }
  128.     public function setEmail(string $email): self
  129.     {
  130.         $this->email $email;
  131.         return $this;
  132.     }
  133.     public function getPhone(): ?string
  134.     {
  135.         return $this->phone;
  136.     }
  137.     public function setPhone(string $phone): self
  138.     {
  139.         $this->phone $phone;
  140.         return $this;
  141.     }
  142.     public function getMessage(): ?string
  143.     {
  144.         return $this->message;
  145.     }
  146.     public function setMessage(?string $message): self
  147.     {
  148.         $this->message $message;
  149.         return $this;
  150.     }
  151.     public function getCrmBody(): ?array
  152.     {
  153.         return $this->crm_body;
  154.     }
  155.     public function setCrmBody(?array $crm_body): self
  156.     {
  157.         $this->crm_body $crm_body;
  158.         return $this;
  159.     }
  160.     public function getCrmResult(): ?array
  161.     {
  162.         return $this->crm_result;
  163.     }
  164.     public function setCrmResult(?array $crm_result): self
  165.     {
  166.         $this->crm_result $crm_result;
  167.         return $this;
  168.     }
  169. }