mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
DX: fix phpstan issues
This commit is contained in:
parent
331443ae12
commit
48772efd54
@ -3,7 +3,7 @@ parameters:
|
|||||||
paths:
|
paths:
|
||||||
- src/
|
- src/
|
||||||
tmpDir: .cache/
|
tmpDir: .cache/
|
||||||
reportUnmatchedIgnoredErrors: true
|
reportUnmatchedIgnoredErrors: false
|
||||||
excludePaths:
|
excludePaths:
|
||||||
- .php_cs*
|
- .php_cs*
|
||||||
- docs/
|
- docs/
|
||||||
|
@ -20,13 +20,6 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class LocationFilter implements FilterInterface
|
class LocationFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
private TranslatableStringHelper $translatableStringHelper;
|
|
||||||
|
|
||||||
public function __construct(TranslatableStringHelper $translatableStringHelper)
|
|
||||||
{
|
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
@ -160,8 +160,8 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
|||||||
return 'export.aside_activity.main_center';
|
return 'export.aside_activity.main_center';
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var Center $c */
|
|
||||||
if (null === $value || '' === $value || null === $c = $this->centerRepository->find($value)) {
|
if (null === $value || '' === $value || null === $c = $this->centerRepository->find($value)) {
|
||||||
|
/** @var Center $c */
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,10 +190,6 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param QueryBuilder $query
|
|
||||||
* @param array $data
|
|
||||||
*/
|
|
||||||
public function getResult($query, $data): array
|
public function getResult($query, $data): array
|
||||||
{
|
{
|
||||||
return $query->getQuery()->getResult(AbstractQuery::HYDRATE_ARRAY);
|
return $query->getQuery()->getResult(AbstractQuery::HYDRATE_ARRAY);
|
||||||
|
@ -33,27 +33,15 @@ class ElementController extends AbstractController
|
|||||||
{
|
{
|
||||||
private CalculatorManager $calculator;
|
private CalculatorManager $calculator;
|
||||||
|
|
||||||
private LoggerInterface $chillMainLogger;
|
|
||||||
|
|
||||||
private EntityManagerInterface $em;
|
|
||||||
|
|
||||||
private ResourceRepository $resourceRepository;
|
private ResourceRepository $resourceRepository;
|
||||||
|
|
||||||
private ChargeRepository $chargeRepository;
|
private ChargeRepository $chargeRepository;
|
||||||
|
|
||||||
private TranslatorInterface $translator;
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
EntityManagerInterface $em,
|
|
||||||
TranslatorInterface $translator,
|
|
||||||
LoggerInterface $chillMainLogger,
|
|
||||||
CalculatorManager $calculator,
|
CalculatorManager $calculator,
|
||||||
ResourceRepository $resourceRepository,
|
ResourceRepository $resourceRepository,
|
||||||
ChargeRepository $chargeRepository,
|
ChargeRepository $chargeRepository,
|
||||||
) {
|
) {
|
||||||
$this->em = $em;
|
|
||||||
$this->translator = $translator;
|
|
||||||
$this->chillMainLogger = $chillMainLogger;
|
|
||||||
$this->calculator = $calculator;
|
$this->calculator = $calculator;
|
||||||
$this->resourceRepository = $resourceRepository;
|
$this->resourceRepository = $resourceRepository;
|
||||||
$this->chargeRepository = $chargeRepository;
|
$this->chargeRepository = $chargeRepository;
|
||||||
|
@ -30,7 +30,7 @@ final class ChargeKindRepository implements ChargeKindRepositoryInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return ChargeType[]
|
* @return array<ChargeKind>
|
||||||
*/
|
*/
|
||||||
public function findAll(): array
|
public function findAll(): array
|
||||||
{
|
{
|
||||||
@ -38,7 +38,7 @@ final class ChargeKindRepository implements ChargeKindRepositoryInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return ChargeType[]
|
* @return array<ChargeKind>
|
||||||
*/
|
*/
|
||||||
public function findAllActive(): array
|
public function findAllActive(): array
|
||||||
{
|
{
|
||||||
@ -53,7 +53,7 @@ final class ChargeKindRepository implements ChargeKindRepositoryInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return ChargeType[]
|
* @return array<ChargeKind>
|
||||||
*/
|
*/
|
||||||
public function findAllByType(string $type): array
|
public function findAllByType(string $type): array
|
||||||
{
|
{
|
||||||
@ -64,7 +64,7 @@ final class ChargeKindRepository implements ChargeKindRepositoryInterface
|
|||||||
* @param mixed|null $limit
|
* @param mixed|null $limit
|
||||||
* @param mixed|null $offset
|
* @param mixed|null $offset
|
||||||
*
|
*
|
||||||
* @return ChargeType[]
|
* @return array<ChargeKind>
|
||||||
*/
|
*/
|
||||||
public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array
|
public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array
|
||||||
{
|
{
|
||||||
|
@ -19,25 +19,25 @@ interface ChargeKindRepositoryInterface extends ObjectRepository
|
|||||||
public function find($id): ?ChargeKind;
|
public function find($id): ?ChargeKind;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return ChargeType[]
|
* @return array<ChargeKind>
|
||||||
*/
|
*/
|
||||||
public function findAll(): array;
|
public function findAll(): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return ChargeType[]
|
* @return array<ChargeKind>
|
||||||
*/
|
*/
|
||||||
public function findAllActive(): array;
|
public function findAllActive(): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return ChargeType[]
|
* @return array<ChargeKind>
|
||||||
*/
|
*/
|
||||||
public function findAllByType(string $type): array;
|
public function findAllByType(string $type): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed|null $limit
|
* @param int|null $limit
|
||||||
* @param mixed|null $offset
|
* @param int|null $offset
|
||||||
*
|
*
|
||||||
* @return ChargeType[]
|
* @return array<ChargeKind>
|
||||||
*/
|
*/
|
||||||
public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array;
|
public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array;
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ final class ResourceKindRepository implements ResourceKindRepositoryInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return ResourceType[]
|
* @return list<ResourceKind>
|
||||||
*/
|
*/
|
||||||
public function findAll(): array
|
public function findAll(): array
|
||||||
{
|
{
|
||||||
@ -38,7 +38,7 @@ final class ResourceKindRepository implements ResourceKindRepositoryInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return ResourceType[]
|
* @return list<ResourceKind>
|
||||||
*/
|
*/
|
||||||
public function findAllActive(): array
|
public function findAllActive(): array
|
||||||
{
|
{
|
||||||
@ -58,7 +58,7 @@ final class ResourceKindRepository implements ResourceKindRepositoryInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return ResourceType[]
|
* @return list<ResourceKind>
|
||||||
*/
|
*/
|
||||||
public function findAllByType(string $type): array
|
public function findAllByType(string $type): array
|
||||||
{
|
{
|
||||||
@ -69,7 +69,7 @@ final class ResourceKindRepository implements ResourceKindRepositoryInterface
|
|||||||
* @param mixed|null $limit
|
* @param mixed|null $limit
|
||||||
* @param mixed|null $offset
|
* @param mixed|null $offset
|
||||||
*
|
*
|
||||||
* @return ResourceType[]
|
* @return list<ResourceKind>
|
||||||
*/
|
*/
|
||||||
public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array
|
public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array
|
||||||
{
|
{
|
||||||
|
@ -19,25 +19,25 @@ interface ResourceKindRepositoryInterface extends ObjectRepository
|
|||||||
public function find($id): ?ResourceKind;
|
public function find($id): ?ResourceKind;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return ResourceType[]
|
* @return list<ResourceKind>
|
||||||
*/
|
*/
|
||||||
public function findAll(): array;
|
public function findAll(): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return ResourceType[]
|
* @return list<ResourceKind>
|
||||||
*/
|
*/
|
||||||
public function findAllActive(): array;
|
public function findAllActive(): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return ResourceType[]
|
* @return list<ResourceKind>
|
||||||
*/
|
*/
|
||||||
public function findAllByType(string $type): array;
|
public function findAllByType(string $type): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed|null $limit
|
* @param int|null $limit
|
||||||
* @param mixed|null $offset
|
* @param int|null $offset
|
||||||
*
|
*
|
||||||
* @return ResourceType[]
|
* @return list<ResourceKind>
|
||||||
*/
|
*/
|
||||||
public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array;
|
public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array;
|
||||||
|
|
||||||
|
@ -544,21 +544,6 @@ class CalendarController extends AbstractController
|
|||||||
return $filterOrder->build();
|
return $filterOrder->build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function buildParamsToUrl(?User $user, ?AccompanyingPeriod $accompanyingPeriod): array
|
|
||||||
{
|
|
||||||
$params = [];
|
|
||||||
|
|
||||||
if (null !== $user) {
|
|
||||||
$params['user_id'] = $user->getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null !== $accompanyingPeriod) {
|
|
||||||
$params['id'] = $accompanyingPeriod->getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $params;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a form to delete a Calendar entity by id.
|
* Creates a form to delete a Calendar entity by id.
|
||||||
*/
|
*/
|
||||||
|
@ -29,6 +29,7 @@ use DateTimeImmutable;
|
|||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\Common\Collections\Criteria;
|
use Doctrine\Common\Collections\Criteria;
|
||||||
|
use Doctrine\Common\Collections\ReadableCollection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use LogicException;
|
use LogicException;
|
||||||
use Symfony\Component\Serializer\Annotation as Serializer;
|
use Symfony\Component\Serializer\Annotation as Serializer;
|
||||||
@ -507,10 +508,10 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Collection|User[]
|
* @return ReadableCollection<(int|string), User>
|
||||||
* @Serializer\Groups({"calendar:read", "read"})
|
* @Serializer\Groups({"calendar:read", "read"})
|
||||||
*/
|
*/
|
||||||
public function getUsers(): Collection
|
public function getUsers(): ReadableCollection
|
||||||
{
|
{
|
||||||
return $this->getInvites()->map(static function (Invite $i) {
|
return $this->getInvites()->map(static function (Invite $i) {
|
||||||
return $i->getUser();
|
return $i->getUser();
|
||||||
|
@ -52,7 +52,7 @@ class CountCalendars implements ExportInterface, GroupedExportInterface
|
|||||||
return 'Exports of calendar';
|
return 'Exports of calendar';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabels($key, array $values, $data): Closure
|
public function getLabels($key, array $values, $data)
|
||||||
{
|
{
|
||||||
if ('export_result' !== $key) {
|
if ('export_result' !== $key) {
|
||||||
throw new LogicException("the key {$key} is not used by this export");
|
throw new LogicException("the key {$key} is not used by this export");
|
||||||
|
@ -31,9 +31,6 @@ class NativeDateIntervalType extends DateIntervalType
|
|||||||
{
|
{
|
||||||
public const FORMAT = '%rP%YY%MM%DDT%HH%IM%SS';
|
public const FORMAT = '%rP%YY%MM%DDT%HH%IM%SS';
|
||||||
|
|
||||||
/**
|
|
||||||
* @param DateInterval|null $value
|
|
||||||
*/
|
|
||||||
public function convertToDatabaseValue($value, AbstractPlatform $platform)
|
public function convertToDatabaseValue($value, AbstractPlatform $platform)
|
||||||
{
|
{
|
||||||
if (null === $value) {
|
if (null === $value) {
|
||||||
|
@ -11,6 +11,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Chill\MainBundle\Export;
|
namespace Chill\MainBundle\Export;
|
||||||
|
|
||||||
|
use Doctrine\ORM\NativeQuery;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -23,6 +24,7 @@ use Doctrine\ORM\QueryBuilder;
|
|||||||
* aggregation, use `ListInterface`.
|
* aggregation, use `ListInterface`.
|
||||||
*
|
*
|
||||||
* @example Chill\PersonBundle\Export\CountPerson an example of implementation
|
* @example Chill\PersonBundle\Export\CountPerson an example of implementation
|
||||||
|
* @template Q of QueryBuilder|NativeQuery
|
||||||
*/
|
*/
|
||||||
interface ExportInterface extends ExportElementInterface
|
interface ExportInterface extends ExportElementInterface
|
||||||
{
|
{
|
||||||
@ -84,7 +86,7 @@ interface ExportInterface extends ExportElementInterface
|
|||||||
* @param mixed[] $values The values from the result. if there are duplicates, those might be given twice. Example: array('FR', 'BE', 'CZ', 'FR', 'BE', 'FR')
|
* @param mixed[] $values The values from the result. if there are duplicates, those might be given twice. Example: array('FR', 'BE', 'CZ', 'FR', 'BE', 'FR')
|
||||||
* @param mixed $data The data from the export's form (as defined in `buildForm`)
|
* @param mixed $data The data from the export's form (as defined in `buildForm`)
|
||||||
*
|
*
|
||||||
* @return pure-callable(null|string|int|float|'_header' $value):string|int|\DateTimeInterface where the first argument is the value, and the function should return the label to show in the formatted file. Example : `function($countryCode) use ($countries) { return $countries[$countryCode]->getName(); }`
|
* @return callable(null|string|int|float|'_header' $value): string|int|\DateTimeInterface where the first argument is the value, and the function should return the label to show in the formatted file. Example : `function($countryCode) use ($countries) { return $countries[$countryCode]->getName(); }`
|
||||||
*/
|
*/
|
||||||
public function getLabels($key, array $values, $data);
|
public function getLabels($key, array $values, $data);
|
||||||
|
|
||||||
@ -102,7 +104,7 @@ interface ExportInterface extends ExportElementInterface
|
|||||||
/**
|
/**
|
||||||
* Return the results of the query builder.
|
* Return the results of the query builder.
|
||||||
*
|
*
|
||||||
* @param \Doctrine\ORM\NativeQuery|QueryBuilder $query
|
* @param Q $query
|
||||||
* @param mixed[] $data the data from the export's fomr (added by self::buildForm)
|
* @param mixed[] $data the data from the export's fomr (added by self::buildForm)
|
||||||
*
|
*
|
||||||
* @return mixed[] an array of results
|
* @return mixed[] an array of results
|
||||||
@ -132,7 +134,7 @@ interface ExportInterface extends ExportElementInterface
|
|||||||
* @param array $acl an array where each row has a `center` key containing the Chill\MainBundle\Entity\Center, and `circles` keys containing the reachable circles. Example: `array( array('center' => $centerA, 'circles' => array($circleA, $circleB) ) )`
|
* @param array $acl an array where each row has a `center` key containing the Chill\MainBundle\Entity\Center, and `circles` keys containing the reachable circles. Example: `array( array('center' => $centerA, 'circles' => array($circleA, $circleB) ) )`
|
||||||
* @param array $data the data from the form, if any
|
* @param array $data the data from the form, if any
|
||||||
*
|
*
|
||||||
* @return \Doctrine\ORM\NativeQuery|QueryBuilder the query to execute.
|
* @return Q the query to execute.
|
||||||
*/
|
*/
|
||||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = []);
|
public function initiateQuery(array $requiredModifiers, array $acl, array $data = []);
|
||||||
|
|
||||||
|
@ -24,15 +24,7 @@ class ExportPickCenterDataMapper implements DataMapperInterface
|
|||||||
{
|
{
|
||||||
protected RegroupmentRepository $regroupmentRepository;
|
protected RegroupmentRepository $regroupmentRepository;
|
||||||
|
|
||||||
/**
|
public function mapDataToForms($data, $forms): void
|
||||||
* @param array|Center[] $data
|
|
||||||
* @param $forms
|
|
||||||
*
|
|
||||||
* @throws Exception
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function mapDataToForms($data, $forms)
|
|
||||||
{
|
{
|
||||||
if (null === $data) {
|
if (null === $data) {
|
||||||
return;
|
return;
|
||||||
@ -44,7 +36,9 @@ class ExportPickCenterDataMapper implements DataMapperInterface
|
|||||||
$pickedRegroupment = [];
|
$pickedRegroupment = [];
|
||||||
|
|
||||||
foreach ($this->regroupmentRepository->findAll() as $regroupment) {
|
foreach ($this->regroupmentRepository->findAll() as $regroupment) {
|
||||||
[$contained, $notContained] = $regroupment->getCenters()->partition(static function (Center $center) {
|
/** @phpstan-ignore-next-line */
|
||||||
|
[$contained, $notContained] = $regroupment->getCenters()->partition(static function (Center $center): bool {
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (0 === count($notContained)) {
|
if (0 === count($notContained)) {
|
||||||
@ -56,13 +50,7 @@ class ExportPickCenterDataMapper implements DataMapperInterface
|
|||||||
$form['centers']->setData($data);
|
$form['centers']->setData($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function mapFormsToData($forms, &$data): void
|
||||||
* @param iterable $forms
|
|
||||||
* @param array $data
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function mapFormsToData($forms, &$data)
|
|
||||||
{
|
{
|
||||||
/** @var array<string, FormInterface> $forms */
|
/** @var array<string, FormInterface> $forms */
|
||||||
$forms = iterator_to_array($forms);
|
$forms = iterator_to_array($forms);
|
||||||
@ -74,8 +62,8 @@ class ExportPickCenterDataMapper implements DataMapperInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (array_key_exists('regroupment', $forms)) {
|
if (array_key_exists('regroupment', $forms)) {
|
||||||
|
/** @var Regroupment $regroupment */
|
||||||
foreach ($forms['regroupment']->getData() as $regroupment) {
|
foreach ($forms['regroupment']->getData() as $regroupment) {
|
||||||
/** @var Regroupment $regroupment */
|
|
||||||
foreach ($regroupment->getCenters() as $center) {
|
foreach ($regroupment->getCenters() as $center) {
|
||||||
$centers[spl_object_hash($center)] = $center;
|
$centers[spl_object_hash($center)] = $center;
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Chill\MainBundle\Workflow;
|
namespace Chill\MainBundle\Workflow;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Entity\User;
|
||||||
use Chill\MainBundle\Entity\Workflow\EntityWorkflow;
|
use Chill\MainBundle\Entity\Workflow\EntityWorkflow;
|
||||||
|
|
||||||
interface EntityWorkflowHandlerInterface
|
interface EntityWorkflowHandlerInterface
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -82,7 +82,7 @@ class HouseholdController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
usort($accompanyingPeriods, static function ($a, $b) {
|
usort($accompanyingPeriods, static function ($a, $b) {
|
||||||
return $b->getOpeningDate() > $a->getOpeningDate();
|
return $b->getOpeningDate() <=> $a->getOpeningDate();
|
||||||
});
|
});
|
||||||
|
|
||||||
$oldMembers = $household->getNonCurrentMembers();
|
$oldMembers = $household->getNonCurrentMembers();
|
||||||
|
@ -42,6 +42,7 @@ use DateTimeInterface;
|
|||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\Common\Collections\Criteria;
|
use Doctrine\Common\Collections\Criteria;
|
||||||
|
use Doctrine\Common\Collections\ReadableCollection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use Iterator;
|
use Iterator;
|
||||||
use LogicException;
|
use LogicException;
|
||||||
@ -615,9 +616,9 @@ class AccompanyingPeriod implements
|
|||||||
/**
|
/**
|
||||||
* Get a list of person which have an adresse available for a valid location.
|
* Get a list of person which have an adresse available for a valid location.
|
||||||
*
|
*
|
||||||
* @return Collection|Person[]
|
* @return ReadableCollection<(int|string), Person>
|
||||||
*/
|
*/
|
||||||
public function getAvailablePersonLocation(): Collection
|
public function getAvailablePersonLocation(): ReadableCollection
|
||||||
{
|
{
|
||||||
return $this->getOpenParticipations()
|
return $this->getOpenParticipations()
|
||||||
->filter(
|
->filter(
|
||||||
@ -675,8 +676,9 @@ class AccompanyingPeriod implements
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @Groups({"read"})
|
* @Groups({"read"})
|
||||||
|
* @return ReadableCollection<(int|string), Comment>
|
||||||
*/
|
*/
|
||||||
public function getComments(): Collection
|
public function getComments(): ReadableCollection
|
||||||
{
|
{
|
||||||
$pinnedComment = $this->pinnedComment;
|
$pinnedComment = $this->pinnedComment;
|
||||||
|
|
||||||
@ -700,7 +702,7 @@ class AccompanyingPeriod implements
|
|||||||
/**
|
/**
|
||||||
* @Groups({"docgen:read"})
|
* @Groups({"docgen:read"})
|
||||||
*/
|
*/
|
||||||
public function getCurrentParticipations(): Collection
|
public function getCurrentParticipations(): ReadableCollection
|
||||||
{
|
{
|
||||||
return $this->getOpenParticipations();
|
return $this->getOpenParticipations();
|
||||||
}
|
}
|
||||||
@ -834,7 +836,10 @@ class AccompanyingPeriod implements
|
|||||||
return $collection->count() > 0 ? $collection->first() : null;
|
return $collection->count() > 0 ? $collection->first() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOpenParticipations(): Collection
|
/**
|
||||||
|
* @return ReadableCollection<(int|string), AccompanyingPeriodParticipation>
|
||||||
|
*/
|
||||||
|
public function getOpenParticipations(): ReadableCollection
|
||||||
{
|
{
|
||||||
return $this
|
return $this
|
||||||
->getParticipations()
|
->getParticipations()
|
||||||
@ -860,8 +865,9 @@ class AccompanyingPeriod implements
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the participation containing a person.
|
* Get the participation containing a person.
|
||||||
|
* @return ReadableCollection<(int|string), AccompanyingPeriodParticipation>
|
||||||
*/
|
*/
|
||||||
public function getParticipationsContainsPerson(Person $person): Collection
|
public function getParticipationsContainsPerson(Person $person): ReadableCollection
|
||||||
{
|
{
|
||||||
return $this
|
return $this
|
||||||
->getParticipations()
|
->getParticipations()
|
||||||
|
@ -22,6 +22,7 @@ use DateTimeInterface;
|
|||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\Common\Collections\Criteria;
|
use Doctrine\Common\Collections\Criteria;
|
||||||
|
use Doctrine\Common\Collections\ReadableCollection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use Symfony\Component\Serializer\Annotation as Serializer;
|
use Symfony\Component\Serializer\Annotation as Serializer;
|
||||||
use Symfony\Component\Validator\Constraints as Assert;
|
use Symfony\Component\Validator\Constraints as Assert;
|
||||||
@ -265,7 +266,7 @@ class Household
|
|||||||
* @Serializer\Groups({"read"})
|
* @Serializer\Groups({"read"})
|
||||||
* @Serializer\SerializedName("current_members_id")
|
* @Serializer\SerializedName("current_members_id")
|
||||||
*/
|
*/
|
||||||
public function getCurrentMembersIds(?DateTimeImmutable $now = null): Collection
|
public function getCurrentMembersIds(?DateTimeImmutable $now = null): ReadableCollection
|
||||||
{
|
{
|
||||||
return $this->getCurrentMembers($now)->map(
|
return $this->getCurrentMembers($now)->map(
|
||||||
static fn (HouseholdMember $m) => $m->getId()
|
static fn (HouseholdMember $m) => $m->getId()
|
||||||
@ -332,9 +333,9 @@ class Household
|
|||||||
*
|
*
|
||||||
* Return a list of Person, instead of a list of HouseholdMembers
|
* Return a list of Person, instead of a list of HouseholdMembers
|
||||||
*
|
*
|
||||||
* @return Person[]
|
* @return ReadableCollection<(int|string), Person>
|
||||||
*/
|
*/
|
||||||
public function getCurrentPersons(?DateTimeImmutable $now = null): Collection
|
public function getCurrentPersons(?DateTimeImmutable $now = null): ReadableCollection
|
||||||
{
|
{
|
||||||
return $this->getCurrentMembers($now)
|
return $this->getCurrentMembers($now)
|
||||||
->map(static function (HouseholdMember $m) {
|
->map(static function (HouseholdMember $m) {
|
||||||
@ -358,9 +359,9 @@ class Household
|
|||||||
/**
|
/**
|
||||||
* get all the members during a given membership.
|
* get all the members during a given membership.
|
||||||
*
|
*
|
||||||
* @return Collection|HouseholdMember[]
|
* @return ReadableCollection<(int|string), HouseholdMember>
|
||||||
*/
|
*/
|
||||||
public function getMembersDuringMembership(HouseholdMember $membership): Collection
|
public function getMembersDuringMembership(HouseholdMember $membership): ReadableCollection
|
||||||
{
|
{
|
||||||
return $this->getMembersOnRange(
|
return $this->getMembersOnRange(
|
||||||
$membership->getStartDate(),
|
$membership->getStartDate(),
|
||||||
@ -384,7 +385,7 @@ class Household
|
|||||||
return $this->getMembers()->matching($criteria);
|
return $this->getMembers()->matching($criteria);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMembersOnRange(DateTimeImmutable $from, ?DateTimeImmutable $to): Collection
|
public function getMembersOnRange(DateTimeImmutable $from, ?DateTimeImmutable $to): ReadableCollection
|
||||||
{
|
{
|
||||||
return $this->getMembers()->filter(static function (HouseholdMember $m) use ($from, $to) {
|
return $this->getMembers()->filter(static function (HouseholdMember $m) use ($from, $to) {
|
||||||
if (null === $m->getEndDate() && null !== $to) {
|
if (null === $m->getEndDate() && null !== $to) {
|
||||||
|
@ -28,11 +28,15 @@ class PickPersonDynamicType extends AbstractType
|
|||||||
{
|
{
|
||||||
private DenormalizerInterface $denormalizer;
|
private DenormalizerInterface $denormalizer;
|
||||||
|
|
||||||
private DenormalizerInterface $normalizer;
|
private NormalizerInterface $normalizer;
|
||||||
|
|
||||||
private SerializerInterface $serializer;
|
private SerializerInterface $serializer;
|
||||||
|
|
||||||
public function __construct(DenormalizerInterface $denormalizer, SerializerInterface $serializer, NormalizerInterface $normalizer)
|
public function __construct(
|
||||||
|
DenormalizerInterface $denormalizer,
|
||||||
|
SerializerInterface $serializer,
|
||||||
|
NormalizerInterface $normalizer
|
||||||
|
)
|
||||||
{
|
{
|
||||||
$this->denormalizer = $denormalizer;
|
$this->denormalizer = $denormalizer;
|
||||||
$this->serializer = $serializer;
|
$this->serializer = $serializer;
|
||||||
|
@ -27,6 +27,7 @@ use Chill\PersonBundle\Entity\Person;
|
|||||||
use Chill\PersonBundle\Repository\PersonRepository;
|
use Chill\PersonBundle\Repository\PersonRepository;
|
||||||
use Chill\PersonBundle\Templating\Entity\PersonRenderInterface;
|
use Chill\PersonBundle\Templating\Entity\PersonRenderInterface;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
@ -159,9 +160,9 @@ class AccompanyingPeriodContext implements
|
|||||||
public function buildPublicForm(FormBuilderInterface $builder, DocGeneratorTemplate $template, mixed $entity): void
|
public function buildPublicForm(FormBuilderInterface $builder, DocGeneratorTemplate $template, mixed $entity): void
|
||||||
{
|
{
|
||||||
$options = $template->getOptions();
|
$options = $template->getOptions();
|
||||||
$persons = $entity->getCurrentParticipations()->map(static function (AccompanyingPeriodParticipation $p) {
|
$persons = new ArrayCollection($entity->getCurrentParticipations()->map(static function (AccompanyingPeriodParticipation $p) {
|
||||||
return $p->getPerson();
|
return $p->getPerson();
|
||||||
});
|
})->toArray());
|
||||||
|
|
||||||
foreach ($entity->getCurrentParticipations() as $p) {
|
foreach ($entity->getCurrentParticipations() as $p) {
|
||||||
foreach ($p->getPerson()->getResources() as $r) {
|
foreach ($p->getPerson()->getResources() as $r) {
|
||||||
|
@ -102,7 +102,9 @@ class AccompanyingPeriodWorkWorkflowHandler implements EntityWorkflowHandlerInte
|
|||||||
->getAccompanyingPeriod()
|
->getAccompanyingPeriod()
|
||||||
->getUser();
|
->getUser();
|
||||||
|
|
||||||
$suggestedUsers[spl_object_hash($referrer)] = $referrer;
|
if (null !== $referrer) {
|
||||||
|
$suggestedUsers[spl_object_hash($referrer)] = $referrer;
|
||||||
|
}
|
||||||
|
|
||||||
return $suggestedUsers;
|
return $suggestedUsers;
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ class ReportList implements ExportElementValidatedInterface, ListInterface
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabels($key, array $values, $data): Closure
|
public function getLabels($key, array $values, $data)
|
||||||
{
|
{
|
||||||
switch ($key) {
|
switch ($key) {
|
||||||
case 'person_birthdate':
|
case 'person_birthdate':
|
||||||
|
@ -66,22 +66,6 @@ class LoadThirdParty extends Fixture implements DependentFixtureInterface
|
|||||||
$manager->flush();
|
$manager->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createAddress(): ObjectSet
|
|
||||||
{
|
|
||||||
$loader = new NativeLoader();
|
|
||||||
|
|
||||||
return $loader->loadData([
|
|
||||||
Address::class => [
|
|
||||||
'address1' => [
|
|
||||||
'name' => '<fr_FR:company()>',
|
|
||||||
'telephone' => $this->phoneNumberUtil->getExampleNumber('FR'),
|
|
||||||
'email' => '<email()>',
|
|
||||||
'comment' => '<fr_FR:realTextBetween(10, 500)>',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function getCenters(): Iterator
|
private function getCenters(): Iterator
|
||||||
{
|
{
|
||||||
$references = array_map(
|
$references = array_map(
|
||||||
|
@ -23,6 +23,7 @@ use DateTimeImmutable;
|
|||||||
use DateTimeInterface;
|
use DateTimeInterface;
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
|
use Doctrine\Common\Collections\ReadableCollection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use libphonenumber\PhoneNumber;
|
use libphonenumber\PhoneNumber;
|
||||||
use Symfony\Component\Serializer\Annotation\Context;
|
use Symfony\Component\Serializer\Annotation\Context;
|
||||||
@ -153,7 +154,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
* @ORM\OneToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty", mappedBy="parent",
|
* @ORM\OneToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty", mappedBy="parent",
|
||||||
* cascade={"persist"}, orphanRemoval=true)
|
* cascade={"persist"}, orphanRemoval=true)
|
||||||
*
|
*
|
||||||
* @var Collection|ThirdParty[]
|
* @var Collection<(int|string), ThirdParty>
|
||||||
* @Assert\Valid(traverse=true)
|
* @Assert\Valid(traverse=true)
|
||||||
*/
|
*/
|
||||||
private Collection $children;
|
private Collection $children;
|
||||||
@ -400,7 +401,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
/**
|
/**
|
||||||
* Get the children where active = true.
|
* Get the children where active = true.
|
||||||
*/
|
*/
|
||||||
public function getActiveChildren(): Collection
|
public function getActiveChildren(): ReadableCollection
|
||||||
{
|
{
|
||||||
return $this->children->filter(static fn (ThirdParty $tp) => $tp->getActive());
|
return $this->children->filter(static fn (ThirdParty $tp) => $tp->getActive());
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ class Convert
|
|||||||
'Content-Type' => 'application/pdf',
|
'Content-Type' => 'application/pdf',
|
||||||
]);
|
]);
|
||||||
} catch (ClientExceptionInterface|TransportExceptionInterface|RedirectionExceptionInterface|ServerExceptionInterface $exception) {
|
} catch (ClientExceptionInterface|TransportExceptionInterface|RedirectionExceptionInterface|ServerExceptionInterface $exception) {
|
||||||
return $this->onConversionFailed($url, $response);
|
return $this->onConversionFailed($url, $exception->getResponse());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 5b35e7ccd0735e5593835e28acbf82386c18e1b6
|
Subproject commit 5e478fdfbf429baf3ce852ae69eb1f7101b1b416
|
Loading…
x
Reference in New Issue
Block a user