<?php
namespace App\Entity;
use App\Repository\EstimateRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass=EstimateRepository::class)
* @ORM\HasLifecycleCallbacks
*/
class Estimate
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @Assert\NotBlank()
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @Assert\NotBlank()
* @ORM\Column(type="string", length=255)
*/
private $firstname;
/**
* @Assert\NotBlank()
* @ORM\Column(type="string", length=5)
*/
private $postcode;
/**
* @Assert\NotBlank()
* @ORM\Column(type="string", length=255)
*/
private $town;
/**
* @Assert\NotBlank()
* @ORM\Column(type="string", length=255)
*/
private $phone;
/**
* @Assert\NotBlank()
* @ORM\Column(type="string", length=255)
*/
private $email;
/**
* @Assert\NotBlank()
* @ORM\Column(type="text")
*/
private $description;
/**
* @ORM\Column(type="datetime")
*/
private ?\DateTimeInterface $createdAt;
/**
* @ORM\Column(type="boolean")
*/
private $done;
/**
* @ORM\Column(type="boolean")
*/
private $consentement;
public function __construct() {
$this->createdAt = new \DateTimeImmutable();
}
/**
* @ORM\PrePersist
* @ORM\PreUpdate
*/
public function updatedFields(): void
{
if ($this->getCreatedAt() === null) {
$this->setCreatedAt(new \DateTime('now'));
}
if ($this->getDone() === null) {
$this->setDone(false);
}
if ($this->getConsentement() === null) {
$this->setConsentement(false);
}
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getFirstname(): ?string
{
return $this->firstname;
}
public function setFirstname(string $firstname): self
{
$this->firstname = $firstname;
return $this;
}
public function getFullName(): string
{
return ucfirst($this->getFirstName()) . ' ' . strtoupper($this->getName());
}
public function getPostcode(): ?string
{
return $this->postcode;
}
public function setPostcode(string $postcode): self
{
$this->postcode = $postcode;
return $this;
}
public function getTown(): ?string
{
return $this->town;
}
public function setTown(string $town): self
{
$this->town = $town;
return $this;
}
public function getFullAddress(): string
{
return ucfirst($this->getPostcode()) . ' ' . strtoupper($this->getTown());
}
public function getPhone(): ?string
{
return $this->phone;
}
public function setPhone(string $phone): self
{
$this->phone = $phone;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(string $email): self
{
$this->email = $email;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(string $description): self
{
$this->description = $description;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getDone(): ?bool
{
return $this->done;
}
public function setDone(bool $done): self
{
$this->done = $done;
return $this;
}
public function getConsentement(): ?bool
{
return $this->consentement;
}
public function setConsentement(bool $consentement): self
{
$this->consentement = $consentement;
return $this;
}
}