mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-29 02:53:50 +00:00
Implement voting logic: separation of concerns
A separate AccompanyingCourseDocumentStoredObjectVoter was\ created to handle the specific access to a Stored object\ related to an Accompanying Course Document.
This commit is contained in:
@@ -12,6 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\DocStoreBundle\Repository;
|
||||
|
||||
use Chill\DocStoreBundle\Entity\AccompanyingCourseDocument;
|
||||
use Chill\DocStoreBundle\Entity\StoredObject;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
@@ -45,6 +46,17 @@ class AccompanyingCourseDocumentRepository implements ObjectRepository
|
||||
return $qb->getQuery()->getSingleScalarResult();
|
||||
}
|
||||
|
||||
public function findLinkedCourseDocument(int $storedObjectId): ?AccompanyingCourseDocument {
|
||||
|
||||
$qb = $this->repository->createQueryBuilder('d');
|
||||
$query = $qb->leftJoin('d.storedObject', 'do')
|
||||
->where('do.id = :storedObjectId')
|
||||
->setParameter('storedObjectId', $storedObjectId)
|
||||
->getQuery();
|
||||
|
||||
return $query->getResult();
|
||||
}
|
||||
|
||||
public function find($id): ?AccompanyingCourseDocument
|
||||
{
|
||||
return $this->repository->find($id);
|
||||
@@ -69,4 +81,5 @@ class AccompanyingCourseDocumentRepository implements ObjectRepository
|
||||
{
|
||||
return AccompanyingCourseDocument::class;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user