src/Entity/ProUser.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Validator as VPAssert;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Gedmo\Mapping\Annotation as Gedmo;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. /**
  9.  * @ORM\Entity
  10.  */
  11. class ProUser extends User
  12. {
  13.     /**
  14.      * @ORM\Column(type="string", length=255, nullable=true)
  15.      *
  16.      * @Assert\NotBlank(groups={"registration_pro_1"}, message="assert.user.pro.company.not_blank")
  17.      */
  18.     protected $company;
  19.     /**
  20.      * @ORM\Column(type="string", length=255, nullable=true)
  21.      */
  22.     protected $companyBackup;
  23.     /**
  24.      * @ORM\Column(type="string", length=20, nullable=true)
  25.      *
  26.      * @VPAssert\Vat(groups={"registration_pro_1"})
  27.      */
  28.     protected $VAT;
  29.     /**
  30.      * @ORM\Column(type="string", length=13, nullable=true)
  31.      */
  32.     protected $APE;
  33.     /**
  34.      * @ORM\Column(type="integer", nullable=true)
  35.      */
  36.     protected $soldVehiclesByYear;
  37.     /**
  38.      * @ORM\Column(type="string", length=30, nullable=true)
  39.      */
  40.     protected $fax;
  41.     /**
  42.      * @ORM\Column(type="boolean")
  43.      */
  44.     protected $onlooker;
  45.     /**
  46.      * @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="managedUsers", cascade={"persist"})
  47.      *
  48.      * @ORM\JoinColumn(name="salesman_id", referencedColumnName="id")
  49.      */
  50.     protected $salesman;
  51.     /**
  52.      * @ORM\OneToMany(targetEntity="App\Entity\ShippingAddress", mappedBy="user", cascade={"persist", "remove"})
  53.      *
  54.      * @Assert\Valid
  55.      */
  56.     protected $shippingAddresses;
  57.     /**
  58.      * @ORM\Column(type="string")
  59.      *
  60.      * @Assert\NotBlank(groups={"registration_pro_2"}, message="assert.user.pro.businessRole.not_blank")
  61.      */
  62.     protected $businessRole;
  63.     /**
  64.      * @ORM\Column(type="string", length=255)
  65.      *
  66.      * @Assert\NotBlank(groups={"registration_pro_3_mandate_files"}, message="frontend.page.register_pro.form.required.kbis")
  67.      *
  68.      * @Assert\File(
  69.      *      groups = {"registration_pro"},
  70.      *      maxSize = "8M",
  71.      *      mimeTypes = {
  72.      *          "application/pdf",
  73.      *          "application/x-pdf",
  74.      *          "image/jpeg",
  75.      *          "image/png"
  76.      *      },
  77.      *      mimeTypesMessage = "Mauvais format ! Formats acceptés : pdf, jpeg, png",
  78.      *      maxSizeMessage = "Ce fichier est trop volumineux (maximum à {{ limit }}Mo)"
  79.      * )
  80.      */
  81.     protected $kbis;
  82.     /**
  83.      * @ORM\Column(type="string", length=255)
  84.      *
  85.      * @Assert\NotBlank(groups={"registration_pro_3_mandate_files"}, message="frontend.page.register_pro.form.required.identityCard")
  86.      *
  87.      * @Assert\File(
  88.      *      groups = {"registration_pro"},
  89.      *      maxSize = "8M",
  90.      *      mimeTypes = {
  91.      *          "application/pdf",
  92.      *          "application/x-pdf",
  93.      *          "image/jpeg",
  94.      *          "image/png"
  95.      *      },
  96.      *      mimeTypesMessage = "Mauvais format ! Formats acceptés : pdf, jpeg, png",
  97.      *      maxSizeMessage = "Ce fichier est trop volumineux (maximum à {{ limit }}Mo)"
  98.      * )
  99.      */
  100.     protected $identityCard;
  101.     /**
  102.      * @ORM\Column(type="string", length=255)
  103.      *
  104.      * @Assert\File(
  105.      *      groups = {"registration_pro"},
  106.      *      maxSize = "8M",
  107.      *      mimeTypes = {
  108.      *          "application/pdf",
  109.      *          "application/x-pdf",
  110.      *          "image/jpeg",
  111.      *          "image/png"
  112.      *      },
  113.      *      mimeTypesMessage = "Mauvais format ! Formats acceptés : pdf, jpeg, png",
  114.      *      maxSizeMessage = "Ce fichier est trop volumineux (maximum à {{ limit }}Mo)"
  115.      * )
  116.      */
  117.     protected $additionalFile;
  118.     /**
  119.      * @ORM\Column(type="boolean")
  120.      */
  121.     protected $manager;
  122.     /**
  123.      * @ORM\Column(type="string", length=255)
  124.      */
  125.     protected $companyType;
  126.     /**
  127.      * @ORM\Column(type="string", length=255)
  128.      *
  129.      * @Assert\NotBlank(groups={"company_type"}, message="assert.user.pro.companyTypeOther.not_blank")
  130.      */
  131.     protected $companyTypeOther;
  132.     /**
  133.      * @ORM\Column(type="integer")
  134.      *
  135.      * @Assert\Type(type="integer", groups={"registration_pro"})
  136.      */
  137.     protected $nbEmployees;
  138.     /**
  139.      * @ORM\Column(type="string", length=255)
  140.      */
  141.     protected $source;
  142.     /**
  143.      * @ORM\Column(type="string", length=255, nullable=true)
  144.      *
  145.      * @Assert\NotBlank(groups={"mandate_file"}, message="assert.user.pro.mandate.not_blank")
  146.      *
  147.      * @Assert\File(
  148.      *      groups = {"mandate_file"},
  149.      *      maxSize = "8M",
  150.      *      mimeTypes = {
  151.      *          "application/pdf",
  152.      *          "application/x-pdf",
  153.      *          "image/jpeg",
  154.      *          "image/png"
  155.      *      },
  156.      *      mimeTypesMessage = "Mauvais format ! Formats acceptés : pdf, jpeg, png",
  157.      *      maxSizeMessage = "Ce fichier est trop volumineux (maximum à {{ limit }}Mo)"
  158.      * )
  159.      */
  160.     protected $mandate;
  161.     /**
  162.      * @ORM\Column(type="string", length=255, nullable=true)
  163.      *
  164.      * @Assert\NotBlank(groups={"mandate_file"}, message="assert.user.pro.employee_file.not_blank")
  165.      *
  166.      * @Assert\File(
  167.      *      groups = {"mandate_file"},
  168.      *      maxSize = "8M",
  169.      *      mimeTypes = {
  170.      *          "application/pdf",
  171.      *          "application/x-pdf",
  172.      *          "image/jpeg",
  173.      *          "image/png"
  174.      *      },
  175.      *      mimeTypesMessage = "Mauvais format ! Formats acceptés : pdf, jpeg, png",
  176.      *      maxSizeMessage = "Ce fichier est trop volumineux (maximum à {{ limit }}Mo)"
  177.      * )
  178.      */
  179.     protected $employeeIdentityCard;
  180.     /**
  181.      * @ORM\Column(name="cgv_validated_at", type="datetime")
  182.      */
  183.     protected $cgvValidatedAt;
  184.     /**
  185.      * @ORM\Column(type="string", length=20, nullable=true)
  186.      *
  187.      * @Assert\NotBlank(groups={"france_specific"}, message="assert.user.pro.siret.not_blank")
  188.      *
  189.      * @Assert\Regex(
  190.      *     groups={"france_specific"},
  191.      *     pattern="/^[a-z0-9]{14}$/i",
  192.      *     match=true,
  193.      *     message="assert.user.pro.siret.invalid_format"
  194.      * )
  195.      */
  196.     protected $siret;
  197.     /**
  198.      * @ORM\Column(type="string", length=20, nullable=true)
  199.      *
  200.      * @Assert\NotBlank(groups={"france_specific"}, message="assert.user.pro.siren.not_blank")
  201.      *
  202.      * @Assert\Regex(
  203.      *     groups={"france_specific"},
  204.      *     pattern="/^[a-z0-9]{9}$/i",
  205.      *     match=true,
  206.      *     message="assert.user.pro.siren.invalid_format"
  207.      * )
  208.      */
  209.     protected $siren;
  210.     /**
  211.      * @ORM\Column(type="boolean")
  212.      */
  213.     protected $emailOptin true;
  214.     /**
  215.      * @ORM\Column(type="string", length=255, nullable=true)
  216.      */
  217.     private $companyId;
  218.     public function __construct()
  219.     {
  220.         parent::__construct();
  221.         $this->country null;
  222.         $this->language null;
  223.         $this->needsTransaction false;
  224.         $this->onlooker false;
  225.         $this->shippingAddresses = new ArrayCollection();
  226.     }
  227.     public function setCompany($company): void
  228.     {
  229.         $this->company $company;
  230.     }
  231.     public function getCompany()
  232.     {
  233.         return $this->company;
  234.     }
  235.     public function setCompanyBackup($companyBackup): void
  236.     {
  237.         $this->companyBackup $companyBackup;
  238.     }
  239.     public function getCompanyBackup()
  240.     {
  241.         return $this->companyBackup;
  242.     }
  243.     public function setVAT($vAT): void
  244.     {
  245.         $this->VAT $vAT;
  246.     }
  247.     public function getVAT()
  248.     {
  249.         return $this->VAT;
  250.     }
  251.     public function setAPE($aPE): void
  252.     {
  253.         $this->APE $aPE;
  254.     }
  255.     public function getAPE()
  256.     {
  257.         return $this->APE;
  258.     }
  259.     public function setSoldVehiclesByYear($soldVehiclesByYear): void
  260.     {
  261.         $this->soldVehiclesByYear = (int) $soldVehiclesByYear;
  262.     }
  263.     public function getSoldVehiclesByYear()
  264.     {
  265.         return $this->soldVehiclesByYear;
  266.     }
  267.     public function setFax($fax): void
  268.     {
  269.         $this->fax $fax;
  270.     }
  271.     public function getFax()
  272.     {
  273.         return $this->fax;
  274.     }
  275.     public function setSalesman($salesman): void
  276.     {
  277.         $this->salesman $salesman;
  278.     }
  279.     public function getSalesman()
  280.     {
  281.         return $this->salesman;
  282.     }
  283.     public function setOnlooker($onlooker): void
  284.     {
  285.         $this->onlooker $onlooker;
  286.     }
  287.     public function isOnlooker()
  288.     {
  289.         return (bool) $this->onlooker;
  290.     }
  291.     public function getSalesforceType()
  292.     {
  293.         return parent::SF_TYPE_PROFESSIONAL;
  294.     }
  295.     public function getShippingAddresses()
  296.     {
  297.         return $this->shippingAddresses;
  298.     }
  299.     public function addShippingAddress(ShippingAddress $shippingAddress)
  300.     {
  301.         $shippingAddress->setUser($this);
  302.         $this->shippingAddresses->add($shippingAddress);
  303.         return $this;
  304.     }
  305.     public function removeShippingAddress(ShippingAddress $shippingAddress)
  306.     {
  307.         $shippingAddress->setUser(null);
  308.         $this->shippingAddresses->removeElement($shippingAddress);
  309.         return $this;
  310.     }
  311.     public function setBusinessRole($businessRole): void
  312.     {
  313.         $this->businessRole $businessRole;
  314.     }
  315.     public function getBusinessRole()
  316.     {
  317.         return $this->businessRole;
  318.     }
  319.     public function setKbis($kbis): void
  320.     {
  321.         $this->kbis $kbis;
  322.     }
  323.     public function getKbis()
  324.     {
  325.         return $this->kbis;
  326.     }
  327.     public function setIdentityCard($identityCard): void
  328.     {
  329.         $this->identityCard $identityCard;
  330.     }
  331.     public function getIdentityCard()
  332.     {
  333.         return $this->identityCard;
  334.     }
  335.     public function setAdditionalFile($additionalFile): void
  336.     {
  337.         $this->additionalFile $additionalFile;
  338.     }
  339.     public function getAdditionalFile()
  340.     {
  341.         return $this->additionalFile;
  342.     }
  343.     public function setManager($manager): void
  344.     {
  345.         $this->manager $manager;
  346.     }
  347.     public function getManager()
  348.     {
  349.         return (bool) $this->manager;
  350.     }
  351.     public function setCompanyType($companyType): void
  352.     {
  353.         $this->companyType $companyType;
  354.     }
  355.     public function getCompanyType()
  356.     {
  357.         return $this->companyType;
  358.     }
  359.     public function setCompanyTypeOther($companyTypeOther): void
  360.     {
  361.         $this->companyTypeOther $companyTypeOther;
  362.     }
  363.     public function getCompanyTypeOther()
  364.     {
  365.         return $this->companyTypeOther;
  366.     }
  367.     public function setNbEmployees($nbEmployees): void
  368.     {
  369.         $this->nbEmployees = (int) $nbEmployees;
  370.     }
  371.     public function getNbEmployees()
  372.     {
  373.         return $this->nbEmployees;
  374.     }
  375.     public function setSource($source): void
  376.     {
  377.         $this->source $source;
  378.     }
  379.     public function getSource()
  380.     {
  381.         return $this->source;
  382.     }
  383.     public function setMandate($mandate): void
  384.     {
  385.         $this->mandate $mandate;
  386.     }
  387.     public function getMandate()
  388.     {
  389.         return $this->mandate;
  390.     }
  391.     public function setEmployeeIdentityCard($employeeIdentityCard): void
  392.     {
  393.         $this->employeeIdentityCard $employeeIdentityCard;
  394.     }
  395.     public function getEmployeeIdentityCard()
  396.     {
  397.         return $this->employeeIdentityCard;
  398.     }
  399.     public function setCgvValidatedAt(?\DateTime $cgvValidatedAt null): void
  400.     {
  401.         $this->cgvValidatedAt $cgvValidatedAt;
  402.     }
  403.     public function getCgvValidatedAt()
  404.     {
  405.         return $this->cgvValidatedAt;
  406.     }
  407.     public function setSiret($siret): void
  408.     {
  409.         $this->siret $siret;
  410.     }
  411.     public function getSiret()
  412.     {
  413.         return $this->siret;
  414.     }
  415.     public function setSiren($siren): void
  416.     {
  417.         $this->siren $siren;
  418.     }
  419.     public function getSiren()
  420.     {
  421.         return $this->siren;
  422.     }
  423.     public function setEmailOptin($emailOptin): void
  424.     {
  425.         $this->emailOptin $emailOptin;
  426.     }
  427.     public function isEmailOptin()
  428.     {
  429.         return $this->emailOptin;
  430.     }
  431.     /**
  432.      * @return string
  433.      */
  434.     public function getCompanyId()
  435.     {
  436.         return $this->companyId;
  437.     }
  438.     /**
  439.      * @return $this
  440.      */
  441.     public function setCompanyId(?string $companyId)
  442.     {
  443.         $this->companyId $companyId;
  444.         return $this;
  445.     }
  446.     public function getUserIdentifier(): string
  447.     {
  448.         return $this->username ?? '';
  449.     }
  450. }