src/Entity/Centers.php line 13

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CentersRepository;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. #[ORM\Entity(repositoryClassCentersRepository::class)]
  10. class Centers
  11. {
  12.     
  13.     #[ORM\Id]
  14.     #[ORM\GeneratedValue]
  15.     #[ORM\Column]
  16.     private ?int $id null;
  17.     #[ORM\Column(length255)]
  18.     private ?string $Name null;
  19.     #[ORM\Column(length255nullabletrue)]
  20.     private ?string $Address null;
  21.     #[ORM\Column(length255nullabletrue)]
  22.     #[Assert\Regex(pattern'/^(?:(?:\+|00)34[-.\s]?)?(?:(6\d{8}|[89]\d{8})|(?:[67]\d{8}|[89]\d{8}))$/'message'El número de teléfono no es válido')]
  23.     
  24.     private ?string $Phone null;
  25.     #[ORM\Column(length255nullabletrue)]
  26.     private ?string $Mail null;
  27.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  28.     private ?\DateTimeInterface $Created null;
  29.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  30.     private ?\DateTimeInterface $Updated null;
  31.     #[ORM\OneToMany(mappedBy'center'targetEntityEvents::class)]
  32.     private Collection $events;
  33.     #[ORM\OneToMany(mappedBy'managementCenter'targetEntityUser::class)]
  34.     private Collection $managementUsers;
  35.     public function __construct()
  36.     {
  37.         $this->events = new ArrayCollection();
  38.         $this->managementUsers = new ArrayCollection();
  39.     }
  40.     
  41.     public function getId(): ?int
  42.     {
  43.         return $this->id;
  44.     }
  45.     public function getName(): ?string
  46.     {
  47.         return $this->Name;
  48.     }
  49.     public function setName(string $Name): static
  50.     {
  51.         $this->Name $Name;
  52.         return $this;
  53.     }
  54.     public function getAddress(): ?string
  55.     {
  56.         return $this->Address;
  57.     }
  58.     public function setAddress(?string $Address): static
  59.     {
  60.         $this->Address $Address;
  61.         return $this;
  62.     }
  63.     public function getPhone(): ?string
  64.     {
  65.         return $this->Phone;
  66.     }
  67.     public function setPhone(?string $Phone): static
  68.     {
  69.         $this->Phone $Phone;
  70.         return $this;
  71.     }
  72.     public function getMail(): ?string
  73.     {
  74.         return $this->Mail;
  75.     }
  76.     public function setMail(?string $Mail): static
  77.     {
  78.         $this->Mail $Mail;
  79.         return $this;
  80.     }
  81.     public function getCreated(): ?\DateTimeInterface
  82.     {
  83.         return $this->Created;
  84.     }
  85.     public function setCreated(\DateTimeInterface $Created): static
  86.     {
  87.         $this->Created $Created;
  88.         return $this;
  89.     }
  90.     public function getUpdated(): ?\DateTimeInterface
  91.     {
  92.         return $this->Updated;
  93.     }
  94.     public function setUpdated(\DateTimeInterface $Updated): static
  95.     {
  96.         $this->Updated $Updated;
  97.         return $this;
  98.     }
  99.     public function getEvents(): Collection
  100.     {
  101.         return $this->events;
  102.     }
  103.     public function addEvent(Events $event): static
  104.     {
  105.         if (!$this->events->contains($event)) {
  106.             $this->events->add($event);
  107.             $event->setCenter($this);
  108.         }
  109.         return $this;
  110.     }
  111.     public function removeEvent(Events $event): static
  112.     {
  113.         if ($this->events->removeElement($event)) {
  114.             // set the owning side to null (unless already changed)
  115.             if ($event->getCenter() === $this) {
  116.                 $event->setCenter(null);
  117.             }
  118.         }
  119.         return $this;
  120.     }
  121.     /**
  122.      * @return Collection<int, User>
  123.      */
  124.     public function getManagementUsers(): Collection
  125.     {
  126.         return $this->managementUsers;
  127.     }
  128.    
  129. }