Refactor entities and codebase for native property usage
Some checks failed
CI / Tests (push) Failing after 35s
CI / Deploy (push) Has been skipped

- Replaced getters/setters with direct property access across entities and repositories.
- Added and configured `martin-georgiev/postgresql-for-doctrine` for PostgreSQL enhancements.
- Updated Doctrine configuration with types, mappings, and JSONB query functions.
- Removed unused `EliminationService` and related YAML configurations.
This commit is contained in:
2025-10-07 21:46:20 +02:00
parent ab187a28b9
commit b66d2f9e86
51 changed files with 615 additions and 1023 deletions

View File

@@ -7,7 +7,6 @@ namespace Tvdt\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
use Symfony\Bridge\Doctrine\Types\UuidType;
use Symfony\Component\Uid\Uuid;
use Tvdt\Repository\SeasonRepository;
@@ -18,37 +17,37 @@ class Season
private const string SEASON_CODE_CHARACTERS = 'bcdfghjklmnpqrstvwxz';
#[ORM\Column(type: UuidType::NAME)]
#[ORM\CustomIdGenerator(class: UuidGenerator::class)]
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\Id]
private Uuid $id;
public private(set) Uuid $id;
#[ORM\Column(length: 64)]
private string $name;
public string $name;
#[ORM\Column(length: 5)]
private string $seasonCode;
public string $seasonCode;
/** @var Collection<int, Quiz> */
#[ORM\OneToMany(targetEntity: Quiz::class, mappedBy: 'season', cascade: ['persist'], orphanRemoval: true)]
private Collection $quizzes;
public private(set) Collection $quizzes;
/** @var Collection<int, Candidate> */
#[ORM\OneToMany(targetEntity: Candidate::class, mappedBy: 'season', cascade: ['persist'], orphanRemoval: true)]
#[ORM\OrderBy(['name' => 'ASC'])]
private Collection $candidates;
public private(set) Collection $candidates;
/** @var Collection<int, User> */
#[ORM\ManyToMany(targetEntity: User::class, inversedBy: 'seasons')]
private Collection $owners;
public private(set) Collection $owners;
#[ORM\JoinColumn(nullable: true, onDelete: 'SET NULL')]
#[ORM\ManyToOne]
private ?Quiz $ActiveQuiz = null;
public ?Quiz $activeQuiz = null;
#[ORM\JoinColumn(nullable: true)]
#[ORM\OneToOne(cascade: ['persist', 'remove'])]
private ?SeasonSettings $settings = null;
public ?SeasonSettings $settings = null;
public function __construct()
{
@@ -58,73 +57,26 @@ class Season
$this->owners = new ArrayCollection();
}
public function getId(): Uuid
{
return $this->id;
}
public function getName(): string
{
return $this->name;
}
public function setName(string $name): static
{
$this->name = $name;
return $this;
}
public function getSeasonCode(): ?string
{
return $this->seasonCode;
}
public function setSeasonCode(string $seasonCode): static
{
$this->seasonCode = $seasonCode;
return $this;
}
/** @return Collection<int, Quiz> */
public function getQuizzes(): Collection
{
return $this->quizzes;
}
public function addQuiz(Quiz $quiz): static
{
if (!$this->quizzes->contains($quiz)) {
$this->quizzes->add($quiz);
$quiz->setSeason($this);
$quiz->season = $this;
}
return $this;
}
/** @return Collection<int, Candidate> */
public function getCandidates(): Collection
{
return $this->candidates;
}
public function addCandidate(Candidate $candidate): static
{
if (!$this->candidates->contains($candidate)) {
$this->candidates->add($candidate);
$candidate->setSeason($this);
$candidate->season = $this;
}
return $this;
}
/** @return Collection<int, User> */
public function getOwners(): Collection
{
return $this->owners;
}
public function addOwner(User $owner): static
{
if (!$this->owners->contains($owner)) {
@@ -141,18 +93,6 @@ class Season
return $this;
}
public function getActiveQuiz(): ?Quiz
{
return $this->ActiveQuiz;
}
public function setActiveQuiz(?Quiz $ActiveQuiz): static
{
$this->ActiveQuiz = $ActiveQuiz;
return $this;
}
public function isOwner(User $user): bool
{
return $this->owners->contains($user);
@@ -171,16 +111,4 @@ class Season
return $this;
}
public function getSettings(): ?SeasonSettings
{
return $this->settings;
}
public function setSettings(SeasonSettings $settings): static
{
$this->settings = $settings;
return $this;
}
}