mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
[export][person] Feature: allow to filter accompanying period by
geographical unit
This commit is contained in:
@@ -53,20 +53,36 @@ class GeographicalUnit
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getLayerName(): ?string
|
||||
{
|
||||
return $this->layerName;
|
||||
}
|
||||
|
||||
public function getUnitName(): ?string
|
||||
{
|
||||
return $this->unitName;
|
||||
}
|
||||
|
||||
public function setLayerName(?string $layerName): self
|
||||
/**
|
||||
* @return GeographicalUnitLayer|null
|
||||
*/
|
||||
public function getLayer(): ?GeographicalUnitLayer
|
||||
{
|
||||
$this->layerName = $layerName;
|
||||
return $this->layer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $unitRefId
|
||||
* @return GeographicalUnit
|
||||
*/
|
||||
public function setUnitRefId(string $unitRefId): GeographicalUnit
|
||||
{
|
||||
$this->unitRefId = $unitRefId;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param GeographicalUnitLayer|null $layer
|
||||
* @return GeographicalUnit
|
||||
*/
|
||||
public function setLayer(?GeographicalUnitLayer $layer): GeographicalUnit
|
||||
{
|
||||
$this->layer = $layer;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\MainBundle\Repository;
|
||||
|
||||
use Chill\MainBundle\Entity\GeographicalUnit;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
class GeographicalUnitRepository implements GeographicalUnitRepositoryInterface
|
||||
{
|
||||
private EntityRepository $repository;
|
||||
|
||||
private EntityManagerInterface $em;
|
||||
|
||||
public function __construct(EntityManagerInterface $em)
|
||||
{
|
||||
$this->repository = $em->getRepository($this->getClassName());
|
||||
$this->em = $em;
|
||||
}
|
||||
|
||||
|
||||
public function find($id): ?GeographicalUnit
|
||||
{
|
||||
return $this->repository->find($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will return only partial object, where the @link{GeographicalUnit::geom} property is not loaded
|
||||
*
|
||||
* @return array|GeographicalUnit[]
|
||||
*/
|
||||
public function findAll(): array
|
||||
{
|
||||
return $this->repository
|
||||
->createQueryBuilder('gu')
|
||||
->addSelect('PARTIAL gu.{id,unitName,unitRefId,layer}')
|
||||
->addOrderBy('IDENTITY(gu.layer)')
|
||||
->addOrderBy(('gu.unitName'))
|
||||
->getQuery()
|
||||
->getResult();
|
||||
}
|
||||
|
||||
public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): ?GeographicalUnit
|
||||
{
|
||||
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
|
||||
}
|
||||
|
||||
public function findOneBy(array $criteria): ?GeographicalUnit
|
||||
{
|
||||
return $this->repository->findOneBy($criteria);
|
||||
}
|
||||
|
||||
public function getClassName(): string
|
||||
{
|
||||
return GeographicalUnit::class;
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\MainBundle\Repository;
|
||||
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
|
||||
interface GeographicalUnitRepositoryInterface extends ObjectRepository
|
||||
{
|
||||
|
||||
}
|
Reference in New Issue
Block a user