agregar pabellon a tabla de equipos, mejorar respuesta de registro de usuario, normalizar mensajes de error
This commit is contained in:
@@ -31,9 +31,19 @@ class Facility
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?\DateTimeImmutable $createdAt = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?bool $active = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?array $availableHours = null;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'homeFacility', targetEntity: Team::class)]
|
||||
private Collection $teams;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->games = new ArrayCollection();
|
||||
$this->teams = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
@@ -119,4 +129,58 @@ class Facility
|
||||
$this->createdAt = new \DateTimeImmutable('now', $timezone);
|
||||
}
|
||||
|
||||
public function isActive(): ?bool
|
||||
{
|
||||
return $this->active;
|
||||
}
|
||||
|
||||
public function setActive(?bool $active): static
|
||||
{
|
||||
$this->active = $active;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAvailableHours(): ?array
|
||||
{
|
||||
return $this->availableHours;
|
||||
}
|
||||
|
||||
public function setAvailableHours(?array $availableHours): static
|
||||
{
|
||||
$this->availableHours = $availableHours;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Team>
|
||||
*/
|
||||
public function getTeams(): Collection
|
||||
{
|
||||
return $this->teams;
|
||||
}
|
||||
|
||||
public function addTeam(Team $team): static
|
||||
{
|
||||
if (!$this->teams->contains($team)) {
|
||||
$this->teams->add($team);
|
||||
$team->setHomeFacility($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeTeam(Team $team): static
|
||||
{
|
||||
if ($this->teams->removeElement($team)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($team->getHomeFacility() === $this) {
|
||||
$team->setHomeFacility(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -37,6 +37,9 @@ class Team
|
||||
#[ORM\OneToOne(inversedBy: 'team', cascade: ['persist', 'remove'])]
|
||||
private ?User $captain = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'teams')]
|
||||
private ?Facility $homeFacility = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->seasons = new ArrayCollection();
|
||||
@@ -184,4 +187,16 @@ class Team
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getHomeFacility(): ?Facility
|
||||
{
|
||||
return $this->homeFacility;
|
||||
}
|
||||
|
||||
public function setHomeFacility(?Facility $homeFacility): static
|
||||
{
|
||||
$this->homeFacility = $homeFacility;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user