[export][person] Feature: allow to filter accompanying period by

geographical unit
This commit is contained in:
2022-10-04 15:07:07 +02:00
parent 52435f5331
commit fc567868c1
4 changed files with 164 additions and 49 deletions

View File

@@ -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;
}

View File

@@ -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;
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace Chill\MainBundle\Repository;
use Doctrine\Persistence\ObjectRepository;
interface GeographicalUnitRepositoryInterface extends ObjectRepository
{
}