Add collection and new vocab + mess with repository
This commit is contained in:
@@ -5,6 +5,8 @@ namespace App\Repository;
|
||||
use App\Entity\Bibliography;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\ORM\Query\ResultSetMappingBuilder;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Bibliography>
|
||||
@@ -15,5 +17,24 @@ class BibliographyRepository extends ServiceEntityRepository
|
||||
{
|
||||
parent::__construct($registry, Bibliography::class);
|
||||
}
|
||||
|
||||
public function findAllCollection(int $collectionId): ?ArrayCollection
|
||||
{
|
||||
$rsm = new ResultSetMappingBuilder($this->getEntityManager());
|
||||
$rsm->addRootEntityFromClassMetadata('App\Entity\Bibliography', 'b');
|
||||
|
||||
$query = $this->getEntityManager()->createNativeQuery(
|
||||
"SELECT id, stato, editor, cit_bib, rif_bib FROM bibliography b
|
||||
JOIN rel_riferimento_collezione
|
||||
ON Bibliografia_id_bib = id
|
||||
WHERE Collezione_id_coll = :collId",
|
||||
$rsm
|
||||
);
|
||||
$query->setParameter('collId', $collectionId);
|
||||
|
||||
$bibliographies = new ArrayCollection($query->getResult());
|
||||
|
||||
return $bibliographies;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
20
src/Repository/CollectionRepository.php
Normal file
20
src/Repository/CollectionRepository.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Collection;
|
||||
use App\Repository\BibliographyRepository;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Collection>
|
||||
*/
|
||||
class CollectionRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Collection::class);
|
||||
}
|
||||
}
|
||||
|
||||
18
src/Repository/VocabObjectTypeRepository.php
Normal file
18
src/Repository/VocabObjectTypeRepository.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\VocabObjectType;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<VocabFuncContext>
|
||||
*/
|
||||
class VocabObjectTypeRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, VocabObjectType::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user