Fixed: [list person] fix list person and add new fields

This commit is contained in:
2022-10-26 12:47:32 +02:00
parent 333c305eef
commit f434cc5c02
13 changed files with 457 additions and 92 deletions

View File

@@ -20,32 +20,32 @@ use Symfony\Component\PropertyAccess\PropertyAccessor;
use function strlen;
/**
* Helps to load addresses and format them in list
* Helps to load addresses and format them in list.
*/
class ExportAddressHelper
{
public const ATTRIBUTES = 0b01000000;
public const F_AS_STRING = 0b00010000;
public const BUILDING = 0b00001000;
public const F_ATTRIBUTES = 0b01000000;
public const COUNTRY = 0b00000001;
public const F_BUILDING = 0b00001000;
public const GEOM = 0b00100000;
public const F_COUNTRY = 0b00000001;
public const POSTAL_CODE = 0b00000010;
public const F_GEOM = 0b00100000;
public const STREET = 0b00000100;
public const F_POSTAL_CODE = 0b00000010;
public const STRING = 0b00010000;
public const F_STREET = 0b00000100;
private const ALL = [
'country' => self::COUNTRY,
'postal_code' => self::POSTAL_CODE,
'street' => self::STREET,
'building' => self::BUILDING,
'string' => self::STRING,
'geom' => self::GEOM,
'attributes' => self::ATTRIBUTES,
'country' => self::F_COUNTRY,
'postal_code' => self::F_POSTAL_CODE,
'street' => self::F_STREET,
'building' => self::F_BUILDING,
'string' => self::F_AS_STRING,
'geom' => self::F_GEOM,
'attributes' => self::F_ATTRIBUTES,
];
private const COLUMN_MAPPING = [
@@ -78,6 +78,8 @@ class ExportAddressHelper
}
/**
* @param self::F_* $params
*
* @return array|string[]
*/
public function getKeys(int $params, string $prefix = ''): array

View File

@@ -12,19 +12,40 @@ declare(strict_types=1);
namespace Chill\MainBundle\Repository;
use Chill\MainBundle\Entity\Civility;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
/**
* @method Civility|null find($id, $lockMode = null, $lockVersion = null)
* @method Civility|null findOneBy(array $criteria, array $orderBy = null)
* @method Civility[] findAll()
* @method Civility[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class CivilityRepository extends ServiceEntityRepository
class CivilityRepository implements CivilityRepositoryInterface
{
public function __construct(ManagerRegistry $registry)
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{
parent::__construct($registry, Civility::class);
$this->repository = $entityManager->getRepository($this->getClassName());
}
public function find($id): ?Civility
{
return $this->repository->find($id);
}
public function findAll(): array
{
return $this->repository->findAll();
}
public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array
{
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
}
public function findOneBy(array $criteria): ?Civility
{
return $this->repository->findOneBy($criteria);
}
public function getClassName(): string
{
return Civility::class;
}
}

View File

@@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
/*
* 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.
*/
namespace Chill\MainBundle\Repository;
use Chill\MainBundle\Entity\Civility;
use Doctrine\Persistence\ObjectRepository;
interface CivilityRepositoryInterface extends ObjectRepository
{
public function find($id): ?Civility;
/**
* @return array|Civility[]
*/
public function findAll(): array;
/**
* @return array|Civility[]
*/
public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array;
public function findOneBy(array $criteria): ?Civility;
public function getClassName(): string;
}

View File

@@ -14,15 +14,14 @@ namespace Chill\MainBundle\Repository;
use Chill\MainBundle\Entity\Language;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Doctrine\Persistence\ObjectRepository;
final class LanguageRepository implements ObjectRepository
final class LanguageRepository implements LanguageRepositoryInterface
{
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{
$this->repository = $entityManager->getRepository(Language::class);
$this->repository = $entityManager->getRepository($this->getClassName());
}
public function find($id, $lockMode = null, $lockVersion = null): ?Language
@@ -54,7 +53,7 @@ final class LanguageRepository implements ObjectRepository
return $this->repository->findOneBy($criteria, $orderBy);
}
public function getClassName()
public function getClassName(): string
{
return Language::class;
}

View File

@@ -0,0 +1,37 @@
<?php
declare(strict_types=1);
/*
* 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.
*/
namespace Chill\MainBundle\Repository;
use Chill\MainBundle\Entity\Language;
use Doctrine\Persistence\ObjectRepository;
interface LanguageRepositoryInterface extends ObjectRepository
{
public function find($id, $lockMode = null, $lockVersion = null): ?Language;
/**
* @return Language[]
*/
public function findAll(): array;
/**
* @param mixed|null $limit
* @param mixed|null $offset
*
* @return Language[]
*/
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array;
public function findOneBy(array $criteria, ?array $orderBy = null): ?Language;
public function getClassName(): string;
}

View File

@@ -39,6 +39,8 @@ Last updated by: Dernière mise à jour par
on: "le "
Last updated on: Dernière mise à jour le
by_user: "par "
lifecycleUpdate: Evenements de création et mise à jour
address_fields: Données liées à l'adresse
Edit: Modifier
Update: Mettre à jour
@@ -57,6 +59,7 @@ Until: Jusqu'au
#elements used in software
centers: centres
Centers: Centres
center: centre
comment: commentaire
Comment: Commentaire
Pinned comment: Commentaire épinglé
@@ -236,6 +239,7 @@ Default for: Type de localisation par défaut pour
none: aucun
person: usager
thirdparty: tiers
civility: civilité
#admin section for civility
abbreviation: abbréviation