src/Entity/Estimate.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\EstimateRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\Validator\Constraints as Assert;
  6. /**
  7.  * @ORM\Entity(repositoryClass=EstimateRepository::class)
  8.  * @ORM\HasLifecycleCallbacks
  9.  */
  10. class Estimate
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @Assert\NotBlank()
  20.      * @ORM\Column(type="string", length=255)
  21.      */
  22.     private $name;
  23.     /**
  24.      * @Assert\NotBlank()
  25.      * @ORM\Column(type="string", length=255)
  26.      */
  27.     private $firstname;
  28.     /**
  29.      * @Assert\NotBlank()
  30.      * @ORM\Column(type="string", length=5)
  31.      */
  32.     private $postcode;
  33.     /**
  34.      * @Assert\NotBlank()
  35.      * @ORM\Column(type="string", length=255)
  36.      */
  37.     private $town;
  38.     /**
  39.      * @Assert\NotBlank()
  40.      * @ORM\Column(type="string", length=255)
  41.      */
  42.     private $phone;
  43.     /**
  44.      * @Assert\NotBlank()
  45.      * @ORM\Column(type="string", length=255)
  46.      */
  47.     private $email;
  48.     /**
  49.      * @Assert\NotBlank()
  50.      * @ORM\Column(type="text")
  51.      */
  52.     private $description;
  53.     /**
  54.      * @ORM\Column(type="datetime")
  55.      */
  56.     private ?\DateTimeInterface $createdAt;
  57.     /**
  58.      * @ORM\Column(type="boolean")
  59.      */
  60.     private $done;
  61.     /**
  62.      * @ORM\Column(type="boolean")
  63.      */
  64.     private $consentement;
  65.     public function __construct() {
  66.         $this->createdAt = new \DateTimeImmutable();
  67.     }
  68.     /**
  69.      * @ORM\PrePersist
  70.      * @ORM\PreUpdate
  71.      */
  72.     public function updatedFields(): void
  73.     {
  74.         if ($this->getCreatedAt() === null) {
  75.             $this->setCreatedAt(new \DateTime('now'));
  76.         }
  77.         if ($this->getDone() === null) {
  78.             $this->setDone(false);
  79.         }
  80.         if ($this->getConsentement() === null) {
  81.             $this->setConsentement(false);
  82.         }
  83.     }
  84.     public function getId(): ?int
  85.     {
  86.         return $this->id;
  87.     }
  88.     public function getName(): ?string
  89.     {
  90.         return $this->name;
  91.     }
  92.     public function setName(string $name): self
  93.     {
  94.         $this->name $name;
  95.         return $this;
  96.     }
  97.     public function getFirstname(): ?string
  98.     {
  99.         return $this->firstname;
  100.     }
  101.     public function setFirstname(string $firstname): self
  102.     {
  103.         $this->firstname $firstname;
  104.         return $this;
  105.     }
  106.     public function getFullName(): string
  107.     {
  108.         return ucfirst($this->getFirstName()) . ' ' strtoupper($this->getName());
  109.     }
  110.     public function getPostcode(): ?string
  111.     {
  112.         return $this->postcode;
  113.     }
  114.     public function setPostcode(string $postcode): self
  115.     {
  116.         $this->postcode $postcode;
  117.         return $this;
  118.     }
  119.     public function getTown(): ?string
  120.     {
  121.         return $this->town;
  122.     }
  123.     public function setTown(string $town): self
  124.     {
  125.         $this->town $town;
  126.         return $this;
  127.     }
  128.     public function getFullAddress(): string
  129.     {
  130.         return ucfirst($this->getPostcode()) . ' ' strtoupper($this->getTown());
  131.     }
  132.     public function getPhone(): ?string
  133.     {
  134.         return $this->phone;
  135.     }
  136.     public function setPhone(string $phone): self
  137.     {
  138.         $this->phone $phone;
  139.         return $this;
  140.     }
  141.     public function getEmail(): ?string
  142.     {
  143.         return $this->email;
  144.     }
  145.     public function setEmail(string $email): self
  146.     {
  147.         $this->email $email;
  148.         return $this;
  149.     }
  150.     public function getDescription(): ?string
  151.     {
  152.         return $this->description;
  153.     }
  154.     public function setDescription(string $description): self
  155.     {
  156.         $this->description $description;
  157.         return $this;
  158.     }
  159.     public function getCreatedAt(): ?\DateTimeInterface
  160.     {
  161.         return $this->createdAt;
  162.     }
  163.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  164.     {
  165.         $this->createdAt $createdAt;
  166.         return $this;
  167.     }
  168.     public function getDone(): ?bool
  169.     {
  170.         return $this->done;
  171.     }
  172.     public function setDone(bool $done): self
  173.     {
  174.         $this->done $done;
  175.         return $this;
  176.     }
  177.     public function getConsentement(): ?bool
  178.     {
  179.         return $this->consentement;
  180.     }
  181.     public function setConsentement(bool $consentement): self
  182.     {
  183.         $this->consentement $consentement;
  184.         return $this;
  185.     }
  186. }