<?php
namespace App\Entity;
use App\Validator as VPAssert;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity
*/
class ProUser extends User
{
/**
* @ORM\Column(type="string", length=255, nullable=true)
*
* @Assert\NotBlank(groups={"registration_pro_1"}, message="assert.user.pro.company.not_blank")
*/
protected $company;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $companyBackup;
/**
* @ORM\Column(type="string", length=20, nullable=true)
*
* @VPAssert\Vat(groups={"registration_pro_1"})
*/
protected $VAT;
/**
* @ORM\Column(type="string", length=13, nullable=true)
*/
protected $APE;
/**
* @ORM\Column(type="integer", nullable=true)
*/
protected $soldVehiclesByYear;
/**
* @ORM\Column(type="string", length=30, nullable=true)
*/
protected $fax;
/**
* @ORM\Column(type="boolean")
*/
protected $onlooker;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="managedUsers", cascade={"persist"})
*
* @ORM\JoinColumn(name="salesman_id", referencedColumnName="id")
*/
protected $salesman;
/**
* @ORM\OneToMany(targetEntity="App\Entity\ShippingAddress", mappedBy="user", cascade={"persist", "remove"})
*
* @Assert\Valid
*/
protected $shippingAddresses;
/**
* @ORM\Column(type="string")
*
* @Assert\NotBlank(groups={"registration_pro_2"}, message="assert.user.pro.businessRole.not_blank")
*/
protected $businessRole;
/**
* @ORM\Column(type="string", length=255)
*
* @Assert\NotBlank(groups={"registration_pro_3_mandate_files"}, message="frontend.page.register_pro.form.required.kbis")
*
* @Assert\File(
* groups = {"registration_pro"},
* maxSize = "8M",
* mimeTypes = {
* "application/pdf",
* "application/x-pdf",
* "image/jpeg",
* "image/png"
* },
* mimeTypesMessage = "Mauvais format ! Formats acceptés : pdf, jpeg, png",
* maxSizeMessage = "Ce fichier est trop volumineux (maximum à {{ limit }}Mo)"
* )
*/
protected $kbis;
/**
* @ORM\Column(type="string", length=255)
*
* @Assert\NotBlank(groups={"registration_pro_3_mandate_files"}, message="frontend.page.register_pro.form.required.identityCard")
*
* @Assert\File(
* groups = {"registration_pro"},
* maxSize = "8M",
* mimeTypes = {
* "application/pdf",
* "application/x-pdf",
* "image/jpeg",
* "image/png"
* },
* mimeTypesMessage = "Mauvais format ! Formats acceptés : pdf, jpeg, png",
* maxSizeMessage = "Ce fichier est trop volumineux (maximum à {{ limit }}Mo)"
* )
*/
protected $identityCard;
/**
* @ORM\Column(type="string", length=255)
*
* @Assert\File(
* groups = {"registration_pro"},
* maxSize = "8M",
* mimeTypes = {
* "application/pdf",
* "application/x-pdf",
* "image/jpeg",
* "image/png"
* },
* mimeTypesMessage = "Mauvais format ! Formats acceptés : pdf, jpeg, png",
* maxSizeMessage = "Ce fichier est trop volumineux (maximum à {{ limit }}Mo)"
* )
*/
protected $additionalFile;
/**
* @ORM\Column(type="boolean")
*/
protected $manager;
/**
* @ORM\Column(type="string", length=255)
*/
protected $companyType;
/**
* @ORM\Column(type="string", length=255)
*
* @Assert\NotBlank(groups={"company_type"}, message="assert.user.pro.companyTypeOther.not_blank")
*/
protected $companyTypeOther;
/**
* @ORM\Column(type="integer")
*
* @Assert\Type(type="integer", groups={"registration_pro"})
*/
protected $nbEmployees;
/**
* @ORM\Column(type="string", length=255)
*/
protected $source;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*
* @Assert\NotBlank(groups={"mandate_file"}, message="assert.user.pro.mandate.not_blank")
*
* @Assert\File(
* groups = {"mandate_file"},
* maxSize = "8M",
* mimeTypes = {
* "application/pdf",
* "application/x-pdf",
* "image/jpeg",
* "image/png"
* },
* mimeTypesMessage = "Mauvais format ! Formats acceptés : pdf, jpeg, png",
* maxSizeMessage = "Ce fichier est trop volumineux (maximum à {{ limit }}Mo)"
* )
*/
protected $mandate;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*
* @Assert\NotBlank(groups={"mandate_file"}, message="assert.user.pro.employee_file.not_blank")
*
* @Assert\File(
* groups = {"mandate_file"},
* maxSize = "8M",
* mimeTypes = {
* "application/pdf",
* "application/x-pdf",
* "image/jpeg",
* "image/png"
* },
* mimeTypesMessage = "Mauvais format ! Formats acceptés : pdf, jpeg, png",
* maxSizeMessage = "Ce fichier est trop volumineux (maximum à {{ limit }}Mo)"
* )
*/
protected $employeeIdentityCard;
/**
* @ORM\Column(name="cgv_validated_at", type="datetime")
*/
protected $cgvValidatedAt;
/**
* @ORM\Column(type="string", length=20, nullable=true)
*
* @Assert\NotBlank(groups={"france_specific"}, message="assert.user.pro.siret.not_blank")
*
* @Assert\Regex(
* groups={"france_specific"},
* pattern="/^[a-z0-9]{14}$/i",
* match=true,
* message="assert.user.pro.siret.invalid_format"
* )
*/
protected $siret;
/**
* @ORM\Column(type="string", length=20, nullable=true)
*
* @Assert\NotBlank(groups={"france_specific"}, message="assert.user.pro.siren.not_blank")
*
* @Assert\Regex(
* groups={"france_specific"},
* pattern="/^[a-z0-9]{9}$/i",
* match=true,
* message="assert.user.pro.siren.invalid_format"
* )
*/
protected $siren;
/**
* @ORM\Column(type="boolean")
*/
protected $emailOptin = true;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $companyId;
public function __construct()
{
parent::__construct();
$this->country = null;
$this->language = null;
$this->needsTransaction = false;
$this->onlooker = false;
$this->shippingAddresses = new ArrayCollection();
}
public function setCompany($company): void
{
$this->company = $company;
}
public function getCompany()
{
return $this->company;
}
public function setCompanyBackup($companyBackup): void
{
$this->companyBackup = $companyBackup;
}
public function getCompanyBackup()
{
return $this->companyBackup;
}
public function setVAT($vAT): void
{
$this->VAT = $vAT;
}
public function getVAT()
{
return $this->VAT;
}
public function setAPE($aPE): void
{
$this->APE = $aPE;
}
public function getAPE()
{
return $this->APE;
}
public function setSoldVehiclesByYear($soldVehiclesByYear): void
{
$this->soldVehiclesByYear = (int) $soldVehiclesByYear;
}
public function getSoldVehiclesByYear()
{
return $this->soldVehiclesByYear;
}
public function setFax($fax): void
{
$this->fax = $fax;
}
public function getFax()
{
return $this->fax;
}
public function setSalesman($salesman): void
{
$this->salesman = $salesman;
}
public function getSalesman()
{
return $this->salesman;
}
public function setOnlooker($onlooker): void
{
$this->onlooker = $onlooker;
}
public function isOnlooker()
{
return (bool) $this->onlooker;
}
public function getSalesforceType()
{
return parent::SF_TYPE_PROFESSIONAL;
}
public function getShippingAddresses()
{
return $this->shippingAddresses;
}
public function addShippingAddress(ShippingAddress $shippingAddress)
{
$shippingAddress->setUser($this);
$this->shippingAddresses->add($shippingAddress);
return $this;
}
public function removeShippingAddress(ShippingAddress $shippingAddress)
{
$shippingAddress->setUser(null);
$this->shippingAddresses->removeElement($shippingAddress);
return $this;
}
public function setBusinessRole($businessRole): void
{
$this->businessRole = $businessRole;
}
public function getBusinessRole()
{
return $this->businessRole;
}
public function setKbis($kbis): void
{
$this->kbis = $kbis;
}
public function getKbis()
{
return $this->kbis;
}
public function setIdentityCard($identityCard): void
{
$this->identityCard = $identityCard;
}
public function getIdentityCard()
{
return $this->identityCard;
}
public function setAdditionalFile($additionalFile): void
{
$this->additionalFile = $additionalFile;
}
public function getAdditionalFile()
{
return $this->additionalFile;
}
public function setManager($manager): void
{
$this->manager = $manager;
}
public function getManager()
{
return (bool) $this->manager;
}
public function setCompanyType($companyType): void
{
$this->companyType = $companyType;
}
public function getCompanyType()
{
return $this->companyType;
}
public function setCompanyTypeOther($companyTypeOther): void
{
$this->companyTypeOther = $companyTypeOther;
}
public function getCompanyTypeOther()
{
return $this->companyTypeOther;
}
public function setNbEmployees($nbEmployees): void
{
$this->nbEmployees = (int) $nbEmployees;
}
public function getNbEmployees()
{
return $this->nbEmployees;
}
public function setSource($source): void
{
$this->source = $source;
}
public function getSource()
{
return $this->source;
}
public function setMandate($mandate): void
{
$this->mandate = $mandate;
}
public function getMandate()
{
return $this->mandate;
}
public function setEmployeeIdentityCard($employeeIdentityCard): void
{
$this->employeeIdentityCard = $employeeIdentityCard;
}
public function getEmployeeIdentityCard()
{
return $this->employeeIdentityCard;
}
public function setCgvValidatedAt(?\DateTime $cgvValidatedAt = null): void
{
$this->cgvValidatedAt = $cgvValidatedAt;
}
public function getCgvValidatedAt()
{
return $this->cgvValidatedAt;
}
public function setSiret($siret): void
{
$this->siret = $siret;
}
public function getSiret()
{
return $this->siret;
}
public function setSiren($siren): void
{
$this->siren = $siren;
}
public function getSiren()
{
return $this->siren;
}
public function setEmailOptin($emailOptin): void
{
$this->emailOptin = $emailOptin;
}
public function isEmailOptin()
{
return $this->emailOptin;
}
/**
* @return string
*/
public function getCompanyId()
{
return $this->companyId;
}
/**
* @return $this
*/
public function setCompanyId(?string $companyId)
{
$this->companyId = $companyId;
return $this;
}
public function getUserIdentifier(): string
{
return $this->username ?? '';
}
}