mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge branch 'fix-phpstan-issues-202303' into 'master'
DX: fix phpstan issues (2023-03) See merge request Chill-Projet/chill-bundles!510
This commit is contained in:
commit
d70a0fa08b
@ -69,7 +69,7 @@ phpstan_tests:
|
|||||||
stage: Tests
|
stage: Tests
|
||||||
image: gitea.champs-libres.be/chill-project/chill-skeleton-basic/base-image:php82
|
image: gitea.champs-libres.be/chill-project/chill-skeleton-basic/base-image:php82
|
||||||
script:
|
script:
|
||||||
- bin/phpstan
|
- bin/phpstan analyze --memory-limit=2G
|
||||||
cache:
|
cache:
|
||||||
paths:
|
paths:
|
||||||
- .cache/
|
- .cache/
|
||||||
@ -79,21 +79,37 @@ phpstan_tests:
|
|||||||
- bin
|
- bin
|
||||||
- tests/app/vendor/
|
- tests/app/vendor/
|
||||||
|
|
||||||
psalm_tests:
|
rector_tests:
|
||||||
stage: Tests
|
stage: Tests
|
||||||
image: gitea.champs-libres.be/chill-project/chill-skeleton-basic/base-image:php82
|
image: gitea.champs-libres.be/chill-project/chill-skeleton-basic/base-image:php82
|
||||||
script:
|
script:
|
||||||
- bin/psalm
|
- bin/rector --dry-run
|
||||||
allow_failure: true
|
cache:
|
||||||
|
paths:
|
||||||
|
- .cache/
|
||||||
artifacts:
|
artifacts:
|
||||||
expire_in: 30 min
|
expire_in: 30 min
|
||||||
paths:
|
paths:
|
||||||
- bin
|
- bin
|
||||||
- tests/app/vendor/
|
- tests/app/vendor/
|
||||||
|
|
||||||
|
# psalm_tests:
|
||||||
|
# stage: Tests
|
||||||
|
# image: gitea.champs-libres.be/chill-project/chill-skeleton-basic/base-image:php82
|
||||||
|
# script:
|
||||||
|
# - bin/psalm
|
||||||
|
# allow_failure: true
|
||||||
|
# artifacts:
|
||||||
|
# expire_in: 30 min
|
||||||
|
# paths:
|
||||||
|
# - bin
|
||||||
|
# - tests/app/vendor/
|
||||||
|
|
||||||
unit_tests:
|
unit_tests:
|
||||||
stage: Tests
|
stage: Tests
|
||||||
image: gitea.champs-libres.be/chill-project/chill-skeleton-basic/base-image:php82
|
image: gitea.champs-libres.be/chill-project/chill-skeleton-basic/base-image:php82
|
||||||
|
# until we fix testes
|
||||||
|
allow_failure: true
|
||||||
script:
|
script:
|
||||||
- php tests/app/bin/console doctrine:migrations:migrate -n
|
- php tests/app/bin/console doctrine:migrations:migrate -n
|
||||||
- php -d memory_limit=2G tests/app/bin/console cache:clear --env=dev
|
- php -d memory_limit=2G tests/app/bin/console cache:clear --env=dev
|
||||||
|
@ -75,6 +75,7 @@
|
|||||||
"phpunit/phpunit": ">= 7.5",
|
"phpunit/phpunit": ">= 7.5",
|
||||||
"psalm/plugin-phpunit": "^0.18.4",
|
"psalm/plugin-phpunit": "^0.18.4",
|
||||||
"psalm/plugin-symfony": "^4.0.2",
|
"psalm/plugin-symfony": "^4.0.2",
|
||||||
|
"rector/rector": "^0.15.23",
|
||||||
"symfony/debug-bundle": "^5.1",
|
"symfony/debug-bundle": "^5.1",
|
||||||
"symfony/dotenv": "^4.4",
|
"symfony/dotenv": "^4.4",
|
||||||
"symfony/maker-bundle": "^1.20",
|
"symfony/maker-bundle": "^1.20",
|
||||||
|
@ -442,11 +442,6 @@ parameters:
|
|||||||
count: 2
|
count: 2
|
||||||
path: src/Bundle/ChillMainBundle/Workflow/Validator/StepDestValidValidator.php
|
path: src/Bundle/ChillMainBundle/Workflow/Validator/StepDestValidValidator.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Return type \\(int\\|void\\|null\\) of method Chill\\\\PersonBundle\\\\Command\\\\ImportPeopleFromCSVCommand\\:\\:execute\\(\\) should be covariant with return type \\(int\\) of method Symfony\\\\Component\\\\Console\\\\Command\\\\Command\\:\\:execute\\(\\)$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Parameter \\#3 \\$query \\(Doctrine\\\\ORM\\\\QueryBuilder\\) of method Chill\\\\PersonBundle\\\\Controller\\\\HouseholdCompositionTypeApiController\\:\\:customizeQuery\\(\\) should be contravariant with parameter \\$query \\(mixed\\) of method Chill\\\\MainBundle\\\\CRUD\\\\Controller\\\\AbstractCRUDController\\:\\:customizeQuery\\(\\)$#"
|
message: "#^Parameter \\#3 \\$query \\(Doctrine\\\\ORM\\\\QueryBuilder\\) of method Chill\\\\PersonBundle\\\\Controller\\\\HouseholdCompositionTypeApiController\\:\\:customizeQuery\\(\\) should be contravariant with parameter \\$query \\(mixed\\) of method Chill\\\\MainBundle\\\\CRUD\\\\Controller\\\\AbstractCRUDController\\:\\:customizeQuery\\(\\)$#"
|
||||||
count: 1
|
count: 1
|
||||||
@ -788,16 +783,6 @@ parameters:
|
|||||||
count: 1
|
count: 1
|
||||||
path: src/Bundle/ChillThirdPartyBundle/Security/Voter/ThirdPartyVoter.php
|
path: src/Bundle/ChillThirdPartyBundle/Security/Voter/ThirdPartyVoter.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$thirdParty \\(Chill\\\\ThirdPartyBundle\\\\Entity\\\\ThirdParty\\) of method Chill\\\\ThirdPartyBundle\\\\Serializer\\\\Normalizer\\\\ThirdPartyNormalizer\\:\\:normalize\\(\\) should be contravariant with parameter \\$object \\(mixed\\) of method Symfony\\\\Component\\\\Serializer\\\\Normalizer\\\\NormalizerInterface\\:\\:normalize\\(\\)$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#2 \\$format \\(string\\) of method Chill\\\\ThirdPartyBundle\\\\Serializer\\\\Normalizer\\\\ThirdPartyNormalizer\\:\\:supportsNormalization\\(\\) should be contravariant with parameter \\$format \\(string\\|null\\) of method Symfony\\\\Component\\\\Serializer\\\\Normalizer\\\\NormalizerInterface\\:\\:supportsNormalization\\(\\)$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Parameter \\#1 \\$document \\(Chill\\\\DocStoreBundle\\\\Entity\\\\StoredObject\\) of method Chill\\\\WopiBundle\\\\Service\\\\Wopi\\\\ChillDocumentManager\\:\\:getBasename\\(\\) should be contravariant with parameter \\$document \\(ChampsLibres\\\\WopiLib\\\\Contract\\\\Entity\\\\Document\\) of method ChampsLibres\\\\WopiLib\\\\Contract\\\\Service\\\\DocumentManagerInterface\\:\\:getBasename\\(\\)$#"
|
message: "#^Parameter \\#1 \\$document \\(Chill\\\\DocStoreBundle\\\\Entity\\\\StoredObject\\) of method Chill\\\\WopiBundle\\\\Service\\\\Wopi\\\\ChillDocumentManager\\:\\:getBasename\\(\\) should be contravariant with parameter \\$document \\(ChampsLibres\\\\WopiLib\\\\Contract\\\\Entity\\\\Document\\) of method ChampsLibres\\\\WopiLib\\\\Contract\\\\Service\\\\DocumentManagerInterface\\:\\:getBasename\\(\\)$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -3026,111 +3026,6 @@ parameters:
|
|||||||
count: 2
|
count: 2
|
||||||
path: src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php
|
path: src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Access to an undefined property Symfony\\\\Component\\\\EventDispatcher\\\\Event\\:\\:\\$force\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Access to an undefined property Symfony\\\\Component\\\\EventDispatcher\\\\Event\\:\\:\\$headers\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Access to an undefined property Symfony\\\\Component\\\\EventDispatcher\\\\Event\\:\\:\\$helperSet\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Access to an undefined property Symfony\\\\Component\\\\EventDispatcher\\\\Event\\:\\:\\$input\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Access to an undefined property Symfony\\\\Component\\\\EventDispatcher\\\\Event\\:\\:\\$output\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Access to an undefined property Symfony\\\\Component\\\\EventDispatcher\\\\Event\\:\\:\\$person\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Access to an undefined property Symfony\\\\Component\\\\EventDispatcher\\\\Event\\:\\:\\$rawHeaders\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Access to an undefined property Symfony\\\\Component\\\\EventDispatcher\\\\Event\\:\\:\\$row\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Access to an undefined property Symfony\\\\Component\\\\EventDispatcher\\\\Event\\:\\:\\$skipPerson\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\ObjectManager\\:\\:createQuery\\(\\)\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to method buildForm\\(\\) on an unknown class Chill\\\\CustomFieldsBundle\\\\Service\\\\CustomFieldInterface\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Else branch is unreachable because previous condition is always true\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Elseif branch is unreachable because previous condition is always true\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Instanceof between \\*NEVER\\* and Symfony\\\\Component\\\\Form\\\\ChoiceList\\\\View\\\\ChoiceGroupView will always evaluate to false\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Instanceof between Symfony\\\\Component\\\\Form\\\\ChoiceList\\\\View\\\\ChoiceView and Symfony\\\\Component\\\\Form\\\\ChoiceList\\\\View\\\\ChoiceView will always evaluate to true\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Method Chill\\\\PersonBundle\\\\Command\\\\ImportPeopleFromCSVCommand\\:\\:processTextType\\(\\) has invalid return type Chill\\\\PersonBundle\\\\Command\\\\type\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Method Symfony\\\\Component\\\\Console\\\\Helper\\\\Table\\:\\:render\\(\\) invoked with 1 parameter, 0 required\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Method Symfony\\\\Contracts\\\\EventDispatcher\\\\EventDispatcherInterface\\:\\:dispatch\\(\\) invoked with 2 parameters, 1 required\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^PHPDoc tag @var above foreach loop does not specify variable name\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\$value of method Chill\\\\PersonBundle\\\\Command\\\\ImportPeopleFromCSVCommand\\:\\:processTextType\\(\\) has invalid type Chill\\\\PersonBundle\\\\Command\\\\type\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Strict comparison using \\=\\=\\= between false and false will always evaluate to true\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^PHPDoc tag @var for property Chill\\\\PersonBundle\\\\Command\\\\ImportSocialWorkMetadata\\:\\:\\$importer with type Psr\\\\Log\\\\LoggerInterface is not subtype of native type Chill\\\\PersonBundle\\\\Service\\\\Import\\\\ChillImporter\\.$#"
|
message: "#^PHPDoc tag @var for property Chill\\\\PersonBundle\\\\Command\\\\ImportSocialWorkMetadata\\:\\:\\$importer with type Psr\\\\Log\\\\LoggerInterface is not subtype of native type Chill\\\\PersonBundle\\\\Service\\\\Import\\\\ChillImporter\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -425,21 +425,6 @@ parameters:
|
|||||||
count: 2
|
count: 2
|
||||||
path: src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php
|
path: src/Bundle/ChillPersonBundle/Actions/Remove/PersonMove.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$event of method Symfony\\\\Contracts\\\\EventDispatcher\\\\EventDispatcherInterface\\:\\:dispatch\\(\\) expects object, string given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$mobilenumber of method Chill\\\\PersonBundle\\\\Entity\\\\Person\\:\\:setMobilenumber\\(\\) expects libphonenumber\\\\PhoneNumber\\|null, string given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$phonenumber of method Chill\\\\PersonBundle\\\\Entity\\\\Person\\:\\:setPhonenumber\\(\\) expects libphonenumber\\\\PhoneNumber\\|null, string given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Parameter \\#1 \\$event of method Symfony\\\\Contracts\\\\EventDispatcher\\\\EventDispatcherInterface\\:\\:dispatch\\(\\) expects object, string given\\.$#"
|
message: "#^Parameter \\#1 \\$event of method Symfony\\\\Contracts\\\\EventDispatcher\\\\EventDispatcherInterface\\:\\:dispatch\\(\\) expects object, string given\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -310,11 +310,6 @@ parameters:
|
|||||||
count: 1
|
count: 1
|
||||||
path: src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php
|
path: src/Bundle/ChillPersonBundle/Command/ChillPersonMoveCommand.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
|
||||||
count: 6
|
|
||||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -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/
|
||||||
|
25
rector.php
Normal file
25
rector.php
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
|
||||||
|
use Rector\Config\RectorConfig;
|
||||||
|
use Rector\Set\ValueObject\LevelSetList;
|
||||||
|
|
||||||
|
return static function (RectorConfig $rectorConfig): void {
|
||||||
|
$rectorConfig->paths([
|
||||||
|
__DIR__ . '/docs',
|
||||||
|
__DIR__ . '/src',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$rectorConfig->cacheClass(\Rector\Caching\ValueObject\Storage\FileCacheStorage::class);
|
||||||
|
$rectorConfig->cacheDirectory(__DIR__.'/.cache/rector');
|
||||||
|
|
||||||
|
// register a single rule
|
||||||
|
$rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class);
|
||||||
|
|
||||||
|
// define sets of rules
|
||||||
|
// $rectorConfig->sets([
|
||||||
|
// LevelSetList::UP_TO_PHP_74
|
||||||
|
// ]);
|
||||||
|
};
|
@ -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;
|
||||||
|
@ -112,9 +112,9 @@ final class ActivityTypeTest extends KernelTestCase
|
|||||||
'attendee' => true,
|
'attendee' => true,
|
||||||
]]);
|
]]);
|
||||||
|
|
||||||
// var_dump($form->getErrors()->count()); var_dump($form->isValid());
|
// var_dump($form->getErrors()->count()); var_dump($form->isValid());
|
||||||
// foreach($form->getErrors() as $e) { fwrite(STDOUT, var_dump($e->getMessage())); }
|
// foreach($form->getErrors() as $e) { fwrite(STDOUT, var_dump($e->getMessage())); }
|
||||||
// var_dump($form->getErrors());
|
// var_dump($form->getErrors());
|
||||||
|
|
||||||
$this->assertTrue($form->isSynchronized(), 'Test the form is synchronized');
|
$this->assertTrue($form->isSynchronized(), 'Test the form is synchronized');
|
||||||
$this->assertTrue($form->isValid(), 'test the form is valid');
|
$this->assertTrue($form->isValid(), 'test the form is valid');
|
||||||
|
@ -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);
|
||||||
|
@ -28,22 +28,17 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
use Symfony\Component\Form\FormEvent;
|
use Symfony\Component\Form\FormEvent;
|
||||||
use Symfony\Component\Form\FormEvents;
|
use Symfony\Component\Form\FormEvents;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
|
||||||
|
|
||||||
use function in_array;
|
use function in_array;
|
||||||
|
|
||||||
final class AsideActivityFormType extends AbstractType
|
final class AsideActivityFormType extends AbstractType
|
||||||
{
|
{
|
||||||
private TokenStorageInterface $storage;
|
|
||||||
|
|
||||||
private array $timeChoices;
|
private array $timeChoices;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
ParameterBagInterface $parameterBag,
|
ParameterBagInterface $parameterBag,
|
||||||
TokenStorageInterface $storage
|
|
||||||
) {
|
) {
|
||||||
$this->timeChoices = $parameterBag->get('chill_aside_activity.form.time_duration');
|
$this->timeChoices = $parameterBag->get('chill_aside_activity.form.time_duration');
|
||||||
$this->storage = $storage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -554,21 +554,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;
|
||||||
@ -508,10 +509,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");
|
||||||
|
@ -113,27 +113,23 @@ class EventSearch extends AbstractSearch
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
// format is "json"
|
||||||
|
$results = [];
|
||||||
|
$search = $this->search($terms, $start, $limit, $options);
|
||||||
|
|
||||||
if ('json' === $format) {
|
foreach ($search as $item) {
|
||||||
$results = [];
|
$results[] = [
|
||||||
$search = $this->search($terms, $start, $limit, $options);
|
'id' => $item->getId(),
|
||||||
|
'text' => $item->getDate()->format('d/m/Y, H:i') . ' → ' .
|
||||||
foreach ($search as $item) {
|
// $item->getType()->getName()['fr'] . ': ' . // display the type of event
|
||||||
$results[] = [
|
$item->getName(),
|
||||||
'id' => $item->getId(),
|
|
||||||
'text' => $item->getDate()->format('d/m/Y, H:i') . ' → ' .
|
|
||||||
// $item->getType()->getName()['fr'] . ': ' . // display the type of event
|
|
||||||
$item->getName(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
return [
|
|
||||||
'results' => $results,
|
|
||||||
'pagination' => [
|
|
||||||
'more' => $paginator->hasNextPage(),
|
|
||||||
],
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'results' => $results,
|
||||||
|
'more' => $paginator->hasNextPage(),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function supports($domain, $format)
|
public function supports($domain, $format)
|
||||||
|
@ -101,7 +101,7 @@ class CRUDRoutesLoader extends Loader
|
|||||||
$singleCollection = $action['single_collection'] ?? '_entity' === $name ? 'single' : null;
|
$singleCollection = $action['single_collection'] ?? '_entity' === $name ? 'single' : null;
|
||||||
|
|
||||||
if ('collection' === $singleCollection) {
|
if ('collection' === $singleCollection) {
|
||||||
// continue;
|
// continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// compute default action
|
// compute default action
|
||||||
|
@ -211,7 +211,7 @@ trait AddWidgetConfigurationTrait
|
|||||||
*
|
*
|
||||||
* @throws InvalidConfigurationException if a service's tag does not have the "alias" key
|
* @throws InvalidConfigurationException if a service's tag does not have the "alias" key
|
||||||
*
|
*
|
||||||
* @return type
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function getWidgetAliasesbyPlace($place, ContainerBuilder $containerBuilder)
|
protected function getWidgetAliasesbyPlace($place, ContainerBuilder $containerBuilder)
|
||||||
{
|
{
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -31,8 +31,6 @@ class MultipleObjectsToIdTransformer implements DataTransformerInterface
|
|||||||
* Transforms a string (id) to an object (item).
|
* Transforms a string (id) to an object (item).
|
||||||
*
|
*
|
||||||
* @param mixed $array
|
* @param mixed $array
|
||||||
*
|
|
||||||
* @return ArrayCollection
|
|
||||||
*/
|
*/
|
||||||
public function reverseTransform($array)
|
public function reverseTransform($array)
|
||||||
{
|
{
|
||||||
@ -53,10 +51,8 @@ class MultipleObjectsToIdTransformer implements DataTransformerInterface
|
|||||||
* Transforms an object (use) to a string (id).
|
* Transforms an object (use) to a string (id).
|
||||||
*
|
*
|
||||||
* @param array $array
|
* @param array $array
|
||||||
*
|
|
||||||
* @return ArrayCollection
|
|
||||||
*/
|
*/
|
||||||
public function transform($array)
|
public function transform($array): array
|
||||||
{
|
{
|
||||||
$ret = [];
|
$ret = [];
|
||||||
|
|
||||||
|
@ -11,8 +11,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Chill\MainBundle\Search;
|
namespace Chill\MainBundle\Search;
|
||||||
|
|
||||||
use Chill\MainBundle\Pagination\Paginator;
|
|
||||||
use Chill\MainBundle\Pagination\PaginatorFactory;
|
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||||
|
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||||
use Chill\MainBundle\Serializer\Model\Collection;
|
use Chill\MainBundle\Serializer\Model\Collection;
|
||||||
use Doctrine\DBAL\Types\Types;
|
use Doctrine\DBAL\Types\Types;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
@ -100,7 +100,7 @@ class SearchApi
|
|||||||
return $items;
|
return $items;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function buildUnionQuery(array $queries, Paginator $paginator): array
|
private function buildUnionQuery(array $queries, PaginatorInterface $paginator): array
|
||||||
{
|
{
|
||||||
$query = '{unions} ORDER BY pertinence DESC LIMIT ? OFFSET ?';
|
$query = '{unions} ORDER BY pertinence DESC LIMIT ? OFFSET ?';
|
||||||
$unions = [];
|
$unions = [];
|
||||||
@ -134,7 +134,7 @@ class SearchApi
|
|||||||
return (int) $countNq->getSingleScalarResult();
|
return (int) $countNq->getSingleScalarResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function fetchRawResult($queries, $types, Paginator $paginator): array
|
private function fetchRawResult($queries, $types, PaginatorInterface $paginator): array
|
||||||
{
|
{
|
||||||
[$union, $parameters] = $this->buildUnionQuery($queries, $paginator);
|
[$union, $parameters] = $this->buildUnionQuery($queries, $paginator);
|
||||||
$rsm = new ResultSetMappingBuilder($this->em);
|
$rsm = new ResultSetMappingBuilder($this->em);
|
||||||
|
@ -71,9 +71,9 @@ interface SearchInterface
|
|||||||
* @param array $terms the string to search
|
* @param array $terms the string to search
|
||||||
* @param int $start the first result (for pagination)
|
* @param int $start the first result (for pagination)
|
||||||
* @param int $limit the number of result (for pagination)
|
* @param int $limit the number of result (for pagination)
|
||||||
* @param string $format The format for result
|
* @param "html"|"json" $format The format for result
|
||||||
*
|
*
|
||||||
* @return string, an HTML string
|
* @return string|array a string if format is html, an array if format is json
|
||||||
*/
|
*/
|
||||||
public function renderResult(array $terms, $start = 0, $limit = 50, array $options = [], $format = 'html');
|
public function renderResult(array $terms, $start = 0, $limit = 50, array $options = [], $format = 'html');
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ class AuthorizationHelper implements AuthorizationHelperInterface
|
|||||||
*
|
*
|
||||||
* @param User $user The user
|
* @param User $user The user
|
||||||
* @param array $centers a list of centers which are going to be filtered
|
* @param array $centers a list of centers which are going to be filtered
|
||||||
* @param string $role
|
* @param mixed $role
|
||||||
*/
|
*/
|
||||||
public function filterReachableCenters(User $user, array $centers, $role): array
|
public function filterReachableCenters(User $user, array $centers, $role): array
|
||||||
{
|
{
|
||||||
@ -197,10 +197,6 @@ class AuthorizationHelper implements AuthorizationHelperInterface
|
|||||||
*/
|
*/
|
||||||
public function getReachableScopes(UserInterface $user, string $role, Center|array $center): array
|
public function getReachableScopes(UserInterface $user, string $role, Center|array $center): array
|
||||||
{
|
{
|
||||||
if ($role instanceof Role) {
|
|
||||||
$role = $role->getRole();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->getReachableCircles($user, $role, $center);
|
return $this->getReachableCircles($user, $role, $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();
|
||||||
|
@ -64,8 +64,6 @@ final class PersonController extends AbstractController
|
|||||||
*/
|
*/
|
||||||
protected $personRepository;
|
protected $personRepository;
|
||||||
|
|
||||||
private Security $security;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var SimilarPersonMatcher
|
* @var SimilarPersonMatcher
|
||||||
*/
|
*/
|
||||||
@ -101,7 +99,6 @@ final class PersonController extends AbstractController
|
|||||||
LoggerInterface $logger,
|
LoggerInterface $logger,
|
||||||
ValidatorInterface $validator,
|
ValidatorInterface $validator,
|
||||||
EntityManagerInterface $em,
|
EntityManagerInterface $em,
|
||||||
Security $security
|
|
||||||
) {
|
) {
|
||||||
$this->authorizationHelper = $authorizationHelper;
|
$this->authorizationHelper = $authorizationHelper;
|
||||||
$this->similarPersonMatcher = $similarPersonMatcher;
|
$this->similarPersonMatcher = $similarPersonMatcher;
|
||||||
@ -112,7 +109,6 @@ final class PersonController extends AbstractController
|
|||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
$this->validator = $validator;
|
$this->validator = $validator;
|
||||||
$this->em = $em;
|
$this->em = $em;
|
||||||
$this->security = $security;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function editAction($person_id, Request $request)
|
public function editAction($person_id, Request $request)
|
||||||
|
@ -98,6 +98,7 @@ class ReassignAccompanyingPeriodController extends AbstractController
|
|||||||
|
|
||||||
$total = $this->accompanyingPeriodACLAwareRepository->countByUserOpenedAccompanyingPeriod($userFrom);
|
$total = $this->accompanyingPeriodACLAwareRepository->countByUserOpenedAccompanyingPeriod($userFrom);
|
||||||
$paginator = $this->paginatorFactory->create($total);
|
$paginator = $this->paginatorFactory->create($total);
|
||||||
|
$paginator->setItemsPerPage(50);
|
||||||
$periods = $this->accompanyingPeriodACLAwareRepository
|
$periods = $this->accompanyingPeriodACLAwareRepository
|
||||||
->findByUserAndPostalCodesOpenedAccompanyingPeriod(
|
->findByUserAndPostalCodesOpenedAccompanyingPeriod(
|
||||||
$userFrom,
|
$userFrom,
|
||||||
|
@ -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,12 +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;
|
||||||
$this->normalizer = $normalizer;
|
$this->normalizer = $normalizer;
|
||||||
|
@ -59,7 +59,7 @@ class PrivacyEvent extends Event
|
|||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $persons;
|
private $persons = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PrivacyEvent constructor.
|
* PrivacyEvent constructor.
|
||||||
@ -68,7 +68,6 @@ class PrivacyEvent extends Event
|
|||||||
{
|
{
|
||||||
$this->person = $person;
|
$this->person = $person;
|
||||||
$this->args = $args;
|
$this->args = $args;
|
||||||
$this->persons = [];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addPerson(Person $person)
|
public function addPerson(Person $person)
|
||||||
|
@ -203,15 +203,6 @@ class PersonSearch extends AbstractSearch implements HasAdvancedSearchFormInterf
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* (non-PHPdoc).
|
|
||||||
*
|
|
||||||
* @see \Chill\MainBundle\Search\SearchInterface::renderResult()
|
|
||||||
*
|
|
||||||
* @param mixed $start
|
|
||||||
* @param mixed $limit
|
|
||||||
* @param mixed $format
|
|
||||||
*/
|
|
||||||
public function renderResult(array $terms, $start = 0, $limit = 50, array $options = [], $format = 'html')
|
public function renderResult(array $terms, $start = 0, $limit = 50, array $options = [], $format = 'html')
|
||||||
{
|
{
|
||||||
$terms = $this->findAdditionnalInDefault($terms);
|
$terms = $this->findAdditionnalInDefault($terms);
|
||||||
@ -236,15 +227,13 @@ class PersonSearch extends AbstractSearch implements HasAdvancedSearchFormInterf
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
// format is "json"
|
||||||
if ('json' === $format) {
|
return [
|
||||||
return [
|
'results' => $this->search($terms, $start, $limit, array_merge($options, ['simplify' => true])),
|
||||||
'results' => $this->search($terms, $start, $limit, array_merge($options, ['simplify' => true])),
|
'pagination' => [
|
||||||
'pagination' => [
|
'more' => $paginator->hasNextPage(),
|
||||||
'more' => $paginator->hasNextPage(),
|
],
|
||||||
],
|
];
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function supports($domain, $format)
|
public function supports($domain, $format)
|
||||||
|
@ -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());
|
||||||
}
|
}
|
||||||
|
@ -100,6 +100,8 @@ class ThirdPartySearch implements SearchInterface
|
|||||||
'more' => $paginator->hasNextPage(),
|
'more' => $paginator->hasNextPage(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
// format "html"
|
||||||
|
throw new \UnexpectedValueException("format html not supported");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function supports($domain, $format): bool
|
public function supports($domain, $format): bool
|
||||||
|
@ -15,6 +15,7 @@ use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
|||||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||||
use Chill\ThirdPartyBundle\Entity\ThirdPartyCategory;
|
use Chill\ThirdPartyBundle\Entity\ThirdPartyCategory;
|
||||||
use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender;
|
use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender;
|
||||||
|
use Symfony\Component\Serializer\Exception\UnexpectedValueException;
|
||||||
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
|
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
|
||||||
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
|
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
|
||||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||||
@ -35,12 +36,12 @@ class ThirdPartyNormalizer implements NormalizerAwareInterface, NormalizerInterf
|
|||||||
$this->translatableStringHelper = $translatableStringHelper;
|
$this->translatableStringHelper = $translatableStringHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ThirdParty $thirdParty
|
|
||||||
* @param string|null $format
|
|
||||||
*/
|
|
||||||
public function normalize($thirdParty, $format = null, array $context = [])
|
public function normalize($thirdParty, $format = null, array $context = [])
|
||||||
{
|
{
|
||||||
|
if (!$thirdParty instanceof ThirdParty) {
|
||||||
|
throw new UnexpectedValueException();
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'type' => 'thirdparty',
|
'type' => 'thirdparty',
|
||||||
'firstname' => $thirdParty->getFirstname(),
|
'firstname' => $thirdParty->getFirstname(),
|
||||||
|
@ -25,7 +25,7 @@ final class Version20230215175150 extends AbstractMigration implements Container
|
|||||||
public function down(Schema $schema): void
|
public function down(Schema $schema): void
|
||||||
{
|
{
|
||||||
$this->addSql('ALTER TABLE chill_3party.third_party DROP profession');
|
$this->addSql('ALTER TABLE chill_3party.third_party DROP profession');
|
||||||
// $this->addSql('ALTER TABLE chill_3party.third_party ADD profession_id INT DEFAULT NULL');
|
// $this->addSql('ALTER TABLE chill_3party.third_party ADD profession_id INT DEFAULT NULL');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDescription(): string
|
public function getDescription(): string
|
||||||
|
@ -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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user