This commit is contained in:
2022-10-05 15:23:28 +02:00
parent 58b1778544
commit a967e1ed17
194 changed files with 1580 additions and 1386 deletions

View File

@@ -14,7 +14,6 @@ namespace Chill\MainBundle\Repository;
use Chill\MainBundle\Entity\Center;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Doctrine\Persistence\ObjectRepository;
final class CenterRepository implements CenterRepositoryInterface
{

View File

@@ -1,5 +1,14 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\MainBundle\Repository;
use Chill\MainBundle\Entity\Center;
@@ -8,11 +17,11 @@ use Doctrine\Persistence\ObjectRepository;
interface CenterRepositoryInterface extends ObjectRepository
{
/**
* Return all active centers
* Return all active centers.
*
* Note: this is a teaser: active will comes later on center entity
*
* @return Center[]
*/
public function findActive(): array;
}
}

View File

@@ -1,12 +1,19 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\MainBundle\Repository;
use Chill\MainBundle\Entity\GeographicalUnit;
use Chill\MainBundle\Entity\GeographicalUnitLayer;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use UnexpectedValueException;
final class GeographicalUnitLayerLayerRepository implements GeographicalUnitLayerRepositoryInterface
{
@@ -30,6 +37,15 @@ final class GeographicalUnitLayerLayerRepository implements GeographicalUnitLaye
return $this->repository->findAll();
}
public function findAllHavingUnits(): array
{
$qb = $this->repository->createQueryBuilder('l');
return $qb->where($qb->expr()->gt('SIZE(l.units)', 0))
->getQuery()
->getResult();
}
/**
* @return array|GeographicalUnitLayer[]
*/
@@ -47,13 +63,4 @@ final class GeographicalUnitLayerLayerRepository implements GeographicalUnitLaye
{
return GeographicalUnitLayer::class;
}
public function findAllHavingUnits(): array
{
$qb = $this->repository->createQueryBuilder('l');
return $qb->where($qb->expr()->gt('SIZE(l.units)', 0))
->getQuery()
->getResult();
}
}
}

View File

@@ -1,5 +1,14 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\MainBundle\Repository;
use Chill\MainBundle\Entity\GeographicalUnitLayer;
@@ -11,4 +20,4 @@ interface GeographicalUnitLayerRepositoryInterface extends ObjectRepository
* @return array|GeographicalUnitLayer[]
*/
public function findAllHavingUnits(): array;
}
}

View File

@@ -1,33 +1,39 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\MainBundle\Repository;
use Chill\MainBundle\Entity\GeographicalUnit;
use Chill\MainBundle\Entity\GeographicalUnitDTO;
use Chill\MainBundle\Entity\GeographicalUnitLayer;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
class GeographicalUnitRepository implements GeographicalUnitRepositoryInterface
{
private EntityRepository $repository;
private EntityManagerInterface $em;
private EntityRepository $repository;
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
* Will return only partial object, where the @see{GeographicalUnit::geom} property is not loaded.
*
* @return array|GeographicalUnit[]
*/
@@ -56,4 +62,4 @@ class GeographicalUnitRepository implements GeographicalUnitRepositoryInterface
{
return GeographicalUnit::class;
}
}
}

View File

@@ -1,10 +1,18 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\MainBundle\Repository;
use Doctrine\Persistence\ObjectRepository;
interface GeographicalUnitRepositoryInterface extends ObjectRepository
{
}
}

View File

@@ -15,7 +15,6 @@ use Chill\MainBundle\Entity\Scope;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ObjectRepository;
final class ScopeRepository implements ScopeRepositoryInterface
{

View File

@@ -1,5 +1,14 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\MainBundle\Repository;
use Chill\MainBundle\Entity\Scope;
@@ -18,6 +27,9 @@ interface ScopeRepositoryInterface extends ObjectRepository
public function findAll(): array;
/**
* @param null|mixed $limit
* @param null|mixed $offset
*
* @return Scope[]
*/
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array;
@@ -25,4 +37,4 @@ interface ScopeRepositoryInterface extends ObjectRepository
public function findOneBy(array $criteria, ?array $orderBy = null): ?Scope;
public function getClassName(): string;
}
}