feat: add AwardType entity and repository
This commit is contained in:
69
src/Entity/AwardType.php
Normal file
69
src/Entity/AwardType.php
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use App\Repository\AwardTypeRepository;
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
|
#[ORM\Entity(repositoryClass: AwardTypeRepository::class)]
|
||||||
|
class AwardType
|
||||||
|
{
|
||||||
|
#[ORM\Id]
|
||||||
|
#[ORM\GeneratedValue]
|
||||||
|
#[ORM\Column]
|
||||||
|
private ?int $id = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255)]
|
||||||
|
private string $name;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255)]
|
||||||
|
private string $pattern;
|
||||||
|
|
||||||
|
/** @var Collection<int, Award> */
|
||||||
|
#[ORM\OneToMany(targetEntity: Award::class, mappedBy: 'awardType')]
|
||||||
|
private Collection $awards;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->awards = new ArrayCollection();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getId(): ?int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName(): string
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setName(string $name): static
|
||||||
|
{
|
||||||
|
$this->name = $name;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPattern(): string
|
||||||
|
{
|
||||||
|
return $this->pattern;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPattern(string $pattern): static
|
||||||
|
{
|
||||||
|
$this->pattern = $pattern;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @return Collection<int, Award> */
|
||||||
|
public function getAwards(): Collection
|
||||||
|
{
|
||||||
|
return $this->awards;
|
||||||
|
}
|
||||||
|
}
|
||||||
24
src/Repository/AwardTypeRepository.php
Normal file
24
src/Repository/AwardTypeRepository.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Repository;
|
||||||
|
|
||||||
|
use App\Entity\AwardType;
|
||||||
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
|
/** @extends ServiceEntityRepository<AwardType> */
|
||||||
|
class AwardTypeRepository extends ServiceEntityRepository
|
||||||
|
{
|
||||||
|
public function __construct(ManagerRegistry $registry)
|
||||||
|
{
|
||||||
|
parent::__construct($registry, AwardType::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @return list<AwardType> */
|
||||||
|
public function findAll(): array
|
||||||
|
{
|
||||||
|
return parent::findAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user