45 lines
1.2 KiB
PHP
45 lines
1.2 KiB
PHP
<?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();
|
|
}
|
|
}
|