<?php
namespace App\Entity;
use App\Repository\OrlProspectRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use App\Validator as McaAssert;
/**
* @ORM\Entity(repositoryClass=OrlProspectRepository::class)
*/
class OrlProspect
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="smallint", nullable=true)
*/
private $gender;
/**
* @ORM\Column(type="string", length=255)
* @Assert\NotBlank()
* @Assert\Length(
* min = 2,
* max = 50,
*
* )
*/
private $firstname;
/**
* @ORM\Column(type="string", length=255)
* @Assert\NotBlank
* @Assert\Length(
* min = 2,
* max = 50,
* )
*/
private $lastname;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Assert\Length(
* min = 2,
* max = 50,
* )
*/
private $address;
/**
* @ORM\Column(type="string", length=5)
* @Assert\Regex(
* pattern="/^(([0-8][0-9])|(9[0-5])|(2[ab]))[0-9]{3}$/",
* message="Le code postal n'est pas valide"
* )
*/
private $postalCode;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Assert\NotBlank()
* @Assert\Length(
* min = 2,
* max = 50,
* )
*/
private $city;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Assert\NotBlank
* @Assert\Email(
* message = "L'email '{{ value }}' n'est pas valide",
* mode = "strict"
* )
*/
private $email;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Assert\NotBlank
* @Assert\Regex(pattern="/^(?:\+33|0)\s*[1-9](?:[\s.-]*\d{2}){4}$/", message="Le numéro de téléphone n'est pas valide.")
* @McaAssert\ValidPhoneNumber
*/
private $phoneNumber;
private $isPrivacy;
/**
* @ORM\Column(type="boolean")
*/
private $isOptin;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isPartnerOffer;
/**
* @ORM\OneToMany(targetEntity="App\Entity\OrlProspectOnOrlOffice", mappedBy="orlProspect", cascade={"persist", "remove"})
*/
private $orlProspectsOnOrlOffice;
public function __construct()
{
$this->orlProspectsOnOrlOffice = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getGender(): ?int
{
return $this->gender;
}
public function setGender(?int $gender): self
{
$this->gender = $gender;
return $this;
}
public function getFirstname(): ?string
{
return $this->firstname;
}
public function setFirstname(string $firstname): self
{
$this->firstname = $firstname;
return $this;
}
public function getLastname(): ?string
{
return $this->lastname;
}
public function setLastname(string $lastname): self
{
$this->lastname = $lastname;
return $this;
}
public function getAddress(): ?string
{
return $this->address;
}
public function setAddress(?string $address): self
{
$this->address = $address;
return $this;
}
public function getPostalCode(): ?string
{
return $this->postalCode;
}
public function setPostalCode(string $postalCode): self
{
$this->postalCode = $postalCode;
return $this;
}
public function getCity(): ?string
{
return $this->city;
}
public function setCity(?string $city): self
{
$this->city = $city;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): self
{
$this->email = $email;
return $this;
}
public function getPhoneNumber(): ?string
{
return $this->phoneNumber;
}
public function setPhoneNumber(?string $phoneNumber): self
{
$this->phoneNumber = $phoneNumber;
return $this;
}
public function getIsPrivacy(): ?bool
{
return $this->isPrivacy;
}
public function setIsPrivacy(bool $isPrivacy): self
{
$this->isPrivacy = $isPrivacy;
return $this;
}
public function getIsOptin(): ?bool
{
return $this->isOptin;
}
public function setIsOptin(bool $isOptin): self
{
$this->isOptin = $isOptin;
return $this;
}
public function getIsPartnerOffer(): ?bool
{
return $this->isPartnerOffer;
}
public function setIsPartnerOffer(?bool $isPartnerOffer): self
{
$this->isPartnerOffer = $isPartnerOffer;
return $this;
}
/**
* @return Collection|OrlProspectOnOrlOffice[]
*/
public function getOrlProspectsOnOrlOffice(): Collection
{
return $this->orlProspectsOnOrlOffice;
}
public function addOrlProspectsOnOrlOffice(OrlProspectOnOrlOffice $orlProspectsOnOrlOffice): self
{
if (!$this->orlProspectsOnOrlOffice->contains($orlProspectsOnOrlOffice)) {
$this->orlProspectsOnOrlOffice[] = $orlProspectsOnOrlOffice;
$orlProspectsOnOrlOffice->setOrlProspect($this);
}
return $this;
}
public function removeOrlProspectsOnOrlOffice(OrlProspectOnOrlOffice $orlProspectsOnOrlOffice): self
{
if ($this->orlProspectsOnOrlOffice->contains($orlProspectsOnOrlOffice)) {
$this->orlProspectsOnOrlOffice->removeElement($orlProspectsOnOrlOffice);
// set the owning side to null (unless already changed)
if ($orlProspectsOnOrlOffice->getOrlProspect() === $this) {
$orlProspectsOnOrlOffice->setOrlProspect(null);
}
}
return $this;
}
}