household list of accompanying periods + upgrade DBAL version to 3.1

This commit is contained in:
2021-11-08 10:57:14 +00:00
committed by Julien Fastré
parent 092ea4d57f
commit 7fabe0214e
49 changed files with 353 additions and 286 deletions

View File

@@ -27,7 +27,7 @@ use Chill\MainBundle\Entity\User;
/**
* Interface to implement on classes called in configuration for
* PersonListWidget (`person_list`), under the key `filtering_class` :
*
*
* ```
* widgets:
* homepage:
@@ -35,41 +35,41 @@ use Chill\MainBundle\Entity\User;
* # where \FQDN\To\Class implements PersonFiltering
* class_filtering: \FQDN\To\Class
* ```
*
*
*/
interface PersonFilteringInterface
interface PersonFilteringInterface
{
/**
* Return an array of persons id to show.
*
* Those ids are inserted into the query like this (where ids is the array
*
* Those ids are inserted into the query like this (where ids is the array
* returned by this class) :
*
*
* ```
* SELECT p FROM ChillPersonBundle:Persons p
* SELECT p FROM ChillPersonBundle:Persons p
* WHERE p.id IN (:ids)
* AND
* AND
* -- security/authorization statement: restraint person to authorized centers
* p.center in :authorized_centers
* ```
*
*
* Example of use : filtering based on custom field data :
* ```
class HomepagePersonFiltering implements PersonFilteringInterface {
public function getPersonIds(EntityManager $em, User $user)
{
$rsmBuilder = new ResultSetMappingBuilder($em);
$rsmBuilder->addScalarResult('id', 'id', Type::BIGINT);
$rsmBuilder->addScalarResult('id', 'id', Types::BIGINT);
$personTable = $em->getClassMetadata('ChillPersonBundle:Person')
->getTableName();
$personIdColumn = $em->getClassMetadata('ChillPersonBundle:Person')
->getColumnName('id');
$personCfDataColumn = $em->getClassMetadata('ChillPersonBundle:Person')
->getColumnName('cfData');
return $em->createNativeQuery(sprintf("SELECT %s FROM %s WHERE "
. "jsonb_exists(%s, 'school-2fb5440e-192c-11e6-b2fd-74d02b0c9b55')",
$personIdColumn, $personTable, $personCfDataColumn), $rsmBuilder)
@@ -77,7 +77,7 @@ interface PersonFilteringInterface
}
}
* ```
*
*
* @param EntityManager $em
* @return int[] an array of persons id to show
*/