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.      */
  55.     private ?string $email null;
  56.     private ?bool $active null;
  57.     private ?DateTimeInterface $createdAt null;
  58.     private ?DateTimeInterface $updatedAt null;
  59.     private ?DateTimeInterface $deletedAt null;
  60.     private Collection $minutas;
  61.     public function __construct()
  62.     {
  63.         $this->minutas = new ArrayCollection();
  64.     }
  65.     public function __toString(): string
  66.     {
  67.         return $this->getNombreCompleto();
  68.     }
  69.     public function getDni(): ?string
  70.     {
  71.         return $this->dni;
  72.     }
  73.     public function setDni(?string $dni): static
  74.     {
  75.         $this->dni $dni;
  76.         return $this;
  77.     }
  78.     public function getNombre(): ?string
  79.     {
  80.         return $this->nombre;
  81.     }
  82.     public function setNombre(?string $nombre): static
  83.     {
  84.         $this->nombre $nombre;
  85.         return $this;
  86.     }
  87.     public function getPrimerApellido(): ?string
  88.     {
  89.         return $this->primerApellido;
  90.     }
  91.     public function setPrimerApellido(?string $primerApellido): static
  92.     {
  93.         $this->primerApellido $primerApellido;
  94.         return $this;
  95.     }
  96.     public function getSegundoApellido(): ?string
  97.     {
  98.         return $this->segundoApellido;
  99.     }
  100.     public function setSegundoApellido(?string $segundoApellido): static
  101.     {
  102.         $this->segundoApellido $segundoApellido;
  103.         return $this;
  104.     }
  105.     public function getRepresentacion(): ?string
  106.     {
  107.         return $this->representacion;
  108.     }
  109.     public function setRepresentacion(?string $representacion): static
  110.     {
  111.         $this->representacion $representacion;
  112.         return $this;
  113.     }
  114.     public function getTelefono(): ?string
  115.     {
  116.         return $this->telefono;
  117.     }
  118.     public function setTelefono(?string $telefono): static
  119.     {
  120.         $this->telefono $telefono;
  121.         return $this;
  122.     }
  123.     public function getEmail(): ?string
  124.     {
  125.         return $this->email;
  126.     }
  127.     public function setEmail(?string $email): static
  128.     {
  129.         $this->email $email;
  130.         return $this;
  131.     }
  132.     public function isActive(): ?bool
  133.     {
  134.         return $this->active;
  135.     }
  136.     public function setActive(?bool $active): static
  137.     {
  138.         $this->active $active;
  139.         return $this;
  140.     }
  141.     public function getCreatedAt(): ?\DateTimeInterface
  142.     {
  143.         return $this->createdAt;
  144.     }
  145.     public function setCreatedAt(\DateTimeInterface $createdAt): static
  146.     {
  147.         $this->createdAt $createdAt;
  148.         return $this;
  149.     }
  150.     public function getUpdatedAt(): ?\DateTimeInterface
  151.     {
  152.         return $this->updatedAt;
  153.     }
  154.     public function setUpdatedAt(\DateTimeInterface $updatedAt): static
  155.     {
  156.         $this->updatedAt $updatedAt;
  157.         return $this;
  158.     }
  159.     public function getDeletedAt(): ?\DateTimeInterface
  160.     {
  161.         return $this->deletedAt;
  162.     }
  163.     public function setDeletedAt(?\DateTimeInterface $deletedAt): static
  164.     {
  165.         $this->deletedAt $deletedAt;
  166.         return $this;
  167.     }
  168.     public function getId(): ?Uuid
  169.     {
  170.         return $this->id;
  171.     }
  172.     /**
  173.      * @return Collection<int, Minuta>
  174.      */
  175.     public function getMinutas(): Collection
  176.     {
  177.         return $this->minutas;
  178.     }
  179.     public function addMinuta(Minuta $minuta): static
  180.     {
  181.         if (!$this->minutas->contains($minuta)) {
  182.             $this->minutas->add($minuta);
  183.             $minuta->setPreco($this);
  184.         }
  185.         return $this;
  186.     }
  187.     public function removeMinuta(Minuta $minuta): static
  188.     {
  189.         if ($this->minutas->removeElement($minuta)) {
  190.             // set the owning side to null (unless already changed)
  191.             if ($minuta->getPreco() === $this) {
  192.                 $minuta->setPreco(null);
  193.             }
  194.         }
  195.         return $this;
  196.     }
  197.     public function getNombreCompleto():string
  198.     {
  199.         return implode(' ', [$this->getNombre(), $this->getPrimerApellido(), $this->getSegundoApellido()])??'---';
  200.     }
  201. }