Add Document and Bibliography
This commit is contained in:
44
src/Repository/BibliographyRepository.php
Normal file
44
src/Repository/BibliographyRepository.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Bibliography;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Doctrine\ORM\Query\ResultSetMappingBuilder;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Bibliography>
|
||||
*/
|
||||
class BibliographyRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Bibliography::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Bibliography[]
|
||||
*/
|
||||
public function findAllByNotConserved(int $notConserId): 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_non_conser
|
||||
ON id_bibliografia = b.id
|
||||
WHERE id_non_conser = :id',
|
||||
$rsm
|
||||
);
|
||||
|
||||
$query->setParameter('id', $notConserId);
|
||||
|
||||
return $query->getResult();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user