* mostly complete
This commit is contained in:
43
src/App/Service/AwardeeManager.php
Normal file
43
src/App/Service/AwardeeManager.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Service;
|
||||
|
||||
use App\Entity\Awardee;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
|
||||
class AwardeeManager
|
||||
{
|
||||
/** @var EntityManager */
|
||||
private $entityManager;
|
||||
|
||||
public function __construct(EntityManager $entityManager)
|
||||
{
|
||||
$this->entityManager = $entityManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $year
|
||||
* @return Awardee[]
|
||||
*/
|
||||
public function getJudgesByYear(int $year): ?array
|
||||
{
|
||||
return $this->entityManager->getRepository(Awardee::class)->findBy([
|
||||
'year' => $year,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $slug
|
||||
* @return Awardee|null
|
||||
*/
|
||||
public function getJudgeFromSlug(string $slug): ?Awardee
|
||||
{
|
||||
/** @var Awardee $awardee */
|
||||
$awardee = $this->entityManager->getRepository(Awardee::class)->findOneBy([
|
||||
'slug' => $slug,
|
||||
]);
|
||||
return $awardee;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user