add db and fixtures
This commit is contained in:
parent
03f53f4688
commit
528ebb672a
20 changed files with 1655 additions and 116 deletions
109
src/Entity/Stats.php
Normal file
109
src/Entity/Stats.php
Normal file
|
@ -0,0 +1,109 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\StatsRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: StatsRepository::class)]
|
||||
class Stats
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $zone = null;
|
||||
|
||||
#[ORM\Column(type: Types::SMALLINT)]
|
||||
private ?int $completion_percent = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Place>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: Place::class, mappedBy: 'stats')]
|
||||
private Collection $places;
|
||||
|
||||
#[ORM\Column(type: Types::SMALLINT)]
|
||||
private ?int $places_count = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->places = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getZone(): ?string
|
||||
{
|
||||
return $this->zone;
|
||||
}
|
||||
|
||||
public function setZone(string $zone): static
|
||||
{
|
||||
$this->zone = $zone;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCompletionPercent(): ?int
|
||||
{
|
||||
return $this->completion_percent;
|
||||
}
|
||||
|
||||
public function setCompletionPercent(int $completion_percent): static
|
||||
{
|
||||
$this->completion_percent = $completion_percent;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Place>
|
||||
*/
|
||||
public function getPlaces(): Collection
|
||||
{
|
||||
return $this->places;
|
||||
}
|
||||
|
||||
public function addPlace(Place $place): static
|
||||
{
|
||||
if (!$this->places->contains($place)) {
|
||||
$this->places->add($place);
|
||||
$place->setStats($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removePlace(Place $place): static
|
||||
{
|
||||
if ($this->places->removeElement($place)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($place->getStats() === $this) {
|
||||
$place->setStats(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPlacesCount(): ?int
|
||||
{
|
||||
return $this->places_count;
|
||||
}
|
||||
|
||||
public function setPlacesCount(int $places_count): static
|
||||
{
|
||||
$this->places_count = $places_count;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue