Add site-biblio relation
This commit is contained in:
@@ -17,6 +17,31 @@ class BibliographyRepository extends ServiceEntityRepository
|
||||
parent::__construct($registry, Bibliography::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Bibliography[]
|
||||
*/
|
||||
public function findAllBySite(int $siteId): array
|
||||
{
|
||||
$rsm = new ResultSetMappingBuilder($this->getEntityManager());
|
||||
$rsm->addRootEntityFromClassMetadata('App\Entity\Bibliography', 'b');
|
||||
$query = $this->getEntityManager()->createNativeQuery(
|
||||
'SELECT
|
||||
id,
|
||||
citazione,
|
||||
riferimento,
|
||||
pagine
|
||||
FROM bibliografia b
|
||||
JOIN bibliografia_sito
|
||||
ON id_bibliografia = b.id
|
||||
WHERE id_sito = :id
|
||||
ORDER BY ordine ASC',
|
||||
$rsm
|
||||
);
|
||||
|
||||
$query->setParameter('id', $siteId);
|
||||
|
||||
return $query->getResult();
|
||||
}
|
||||
/**
|
||||
* @return Bibliography[]
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user