src/Domain/Entity/Preco.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Domain\Entity;
  3. use App\Shared\Domain\Validator as CRLAssert;
  4. use DateTimeInterface;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Symfony\Component\Uid\Uuid;
  10. use Symfony\Component\Validator\Constraints as Assert;
  11. class Preco
  12. {
  13.     private ?Uuid $id null;
  14.     /**
  15.      * @var string|null
  16.      * @Assert\Length( max=9, maxMessage="max_length {{ limit }}")
  17.      * @CRLAssert\ConstraintNIF()
  18.      * @Assert\NotBlank(message="not_blank")
  19.      */
  20.     private ?string $dni null;
  21.     /**
  22.      * @var string|null
  23.      * @Assert\NotBlank(message="not_blank")
  24.      */
  25.     private ?string $nombre null;
  26.     /**
  27.      * @var string|null
  28.      * @Assert\NotBlank(message="not_blank")
  29.      */
  30.     private ?string $primerApellido null;
  31.     /**
  32.      * @var string|null
  33.      * @Assert\NotBlank(message="not_blank")
  34.      */
  35.     private ?string $segundoApellido null;
  36.     /**
  37.      * @var string|null
  38.      * @Assert\NotBlank(message="not_blank")
  39.      */
  40.     private ?string $representacion null;
  41.     /**
  42.      * @var string|null
  43.      * @Assert\NotBlank(message="not_blank")
  44.      * @Assert\Regex(
  45.      *     pattern="/^[0-9]+$/",
  46.      *     match=true,
  47.      *     message="The value {{ value }} is not a valid phone number"
  48.      * )
  49.      */
  50.     private ?string $telefono null;
  51.     /**
  52.      * @var string|null
  53.      * @Assert\Email(message="is_not_valid")
  54.      * @Assert\NotBlank(message="not_blank")
  55.      */
  56.     private ?string $email null;
  57.     private ?bool $active null;
  58.     private ?DateTimeInterface $createdAt null;
  59.     private ?DateTimeInterface $updatedAt null;
  60.     private ?DateTimeInterface $deletedAt null;
  61.     private Collection $minutas;
  62.     public function __construct()
  63.     {
  64.         $this->minutas = new ArrayCollection();
  65.     }
  66.     public function __toString(): string
  67.     {
  68.         return $this->getNombreCompleto();
  69.     }
  70.     public function getDni(): ?string
  71.     {
  72.         return $this->dni;
  73.     }
  74.     public function setDni(?string $dni): static
  75.     {
  76.         $this->dni $dni;
  77.         return $this;
  78.     }
  79.     public function getNombre(): ?string
  80.     {
  81.         return $this->nombre;
  82.     }
  83.     public function setNombre(?string $nombre): static
  84.     {
  85.         $this->nombre $nombre;
  86.         return $this;
  87.     }
  88.     public function getPrimerApellido(): ?string
  89.     {
  90.         return $this->primerApellido;
  91.     }
  92.     public function setPrimerApellido(?string $primerApellido): static
  93.     {
  94.         $this->primerApellido $primerApellido;
  95.         return $this;
  96.     }
  97.     public function getSegundoApellido(): ?string
  98.     {
  99.         return $this->segundoApellido;
  100.     }
  101.     public function setSegundoApellido(?string $segundoApellido): static
  102.     {
  103.         $this->segundoApellido $segundoApellido;
  104.         return $this;
  105.     }
  106.     public function getRepresentacion(): ?string
  107.     {
  108.         return $this->representacion;
  109.     }
  110.     public function setRepresentacion(?string $representacion): static
  111.     {
  112.         $this->representacion $representacion;
  113.         return $this;
  114.     }
  115.     public function getTelefono(): ?string
  116.     {
  117.         return $this->telefono;
  118.     }
  119.     public function setTelefono(?string $telefono): static
  120.     {
  121.         $this->telefono $telefono;
  122.         return $this;
  123.     }
  124.     public function getEmail(): ?string
  125.     {
  126.         return $this->email;
  127.     }
  128.     public function setEmail(?string $email): static
  129.     {
  130.         $this->email $email;
  131.         return $this;
  132.     }
  133.     public function isActive(): ?bool
  134.     {
  135.         return $this->active;
  136.     }
  137.     public function setActive(?bool $active): static
  138.     {
  139.         $this->active $active;
  140.         return $this;
  141.     }
  142.     public function getCreatedAt(): ?\DateTimeInterface
  143.     {
  144.         return $this->createdAt;
  145.     }
  146.     public function setCreatedAt(\DateTimeInterface $createdAt): static
  147.     {
  148.         $this->createdAt $createdAt;
  149.         return $this;
  150.     }
  151.     public function getUpdatedAt(): ?\DateTimeInterface
  152.     {
  153.         return $this->updatedAt;
  154.     }
  155.     public function setUpdatedAt(\DateTimeInterface $updatedAt): static
  156.     {
  157.         $this->updatedAt $updatedAt;
  158.         return $this;
  159.     }
  160.     public function getDeletedAt(): ?\DateTimeInterface
  161.     {
  162.         return $this->deletedAt;
  163.     }
  164.     public function setDeletedAt(?\DateTimeInterface $deletedAt): static
  165.     {
  166.         $this->deletedAt $deletedAt;
  167.         return $this;
  168.     }
  169.     public function getId(): ?Uuid
  170.     {
  171.         return $this->id;
  172.     }
  173.     /**
  174.      * @return Collection<int, Minuta>
  175.      */
  176.     public function getMinutas(): Collection
  177.     {
  178.         return $this->minutas;
  179.     }
  180.     public function addMinuta(Minuta $minuta): static
  181.     {
  182.         if (!$this->minutas->contains($minuta)) {
  183.             $this->minutas->add($minuta);
  184.             $minuta->setPreco($this);
  185.         }
  186.         return $this;
  187.     }
  188.     public function removeMinuta(Minuta $minuta): static
  189.     {
  190.         if ($this->minutas->removeElement($minuta)) {
  191.             // set the owning side to null (unless already changed)
  192.             if ($minuta->getPreco() === $this) {
  193.                 $minuta->setPreco(null);
  194.             }
  195.         }
  196.         return $this;
  197.     }
  198.     public function getNombreCompleto():string
  199.     {
  200.         return implode(' ', [$this->getNombre(), $this->getPrimerApellido(), $this->getSegundoApellido()])??'---';
  201.     }
  202. }