mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Fix implicit variable creation.
This commit is contained in:
parent
a1b381a3ea
commit
5e5dcaefe7
@ -150,11 +150,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/Bundle/ChillAsideActivityBundle/src/Menu/AdminMenuBuilder.php
|
||||
|
||||
-
|
||||
message: "#^Implicit array creation is not allowed \\- variable \\$titles does not exist\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillAsideActivityBundle/src/Templating/Entity/CategoryRender.php
|
||||
|
||||
-
|
||||
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
|
||||
count: 3
|
||||
@ -265,11 +260,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldTitle.php
|
||||
|
||||
-
|
||||
message: "#^Implicit array creation is not allowed \\- variable \\$twigConfig does not exist\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillCustomFieldsBundle/DependencyInjection/ChillCustomFieldsExtension.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
@ -330,16 +320,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/Bundle/ChillDocStoreBundle/EntityRepository/DocumentCategoryRepository.php
|
||||
|
||||
-
|
||||
message: "#^Implicit array creation is not allowed \\- variable \\$ignoredParticipations might not exist\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillEventBundle/Controller/ParticipationController.php
|
||||
|
||||
-
|
||||
message: "#^Implicit array creation is not allowed \\- variable \\$newParticipations might not exist\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillEventBundle/Controller/ParticipationController.php
|
||||
|
||||
-
|
||||
message: "#^Variable \\$participation might not be defined\\.$#"
|
||||
count: 3
|
||||
@ -570,21 +550,11 @@ parameters:
|
||||
count: 2
|
||||
path: src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php
|
||||
|
||||
-
|
||||
message: "#^Implicit array creation is not allowed \\- variable \\$countries might not exist\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php
|
||||
|
||||
-
|
||||
message: "#^Method Chill\\\\MainBundle\\\\Command\\\\LoadCountriesCommand\\:\\:execute\\(\\) should return int but return statement is missing\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php
|
||||
|
||||
-
|
||||
message: "#^Variable \\$countries might not be defined\\.$#"
|
||||
count: 2
|
||||
path: src/Bundle/ChillMainBundle/Command/LoadCountriesCommand.php
|
||||
|
||||
-
|
||||
message: "#^Method Chill\\\\MainBundle\\\\Command\\\\LoadPostalCodesCommand\\:\\:execute\\(\\) should return int but return statement is missing\\.$#"
|
||||
count: 1
|
||||
@ -645,16 +615,6 @@ parameters:
|
||||
count: 2
|
||||
path: src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLanguages.php
|
||||
|
||||
-
|
||||
message: "#^Implicit array creation is not allowed \\- variable \\$names might not exist\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLanguages.php
|
||||
|
||||
-
|
||||
message: "#^Variable \\$names might not be defined\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadLanguages.php
|
||||
|
||||
-
|
||||
message: "#^Call to function array_search\\(\\) requires parameter \\#3 to be set\\.$#"
|
||||
count: 5
|
||||
@ -800,11 +760,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Form/Type/ComposedRoleScopeType.php
|
||||
|
||||
-
|
||||
message: "#^Implicit array creation is not allowed \\- variable \\$ids does not exist\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Form/Type/DataTransformer/CenterTransformer.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 3
|
||||
@ -865,11 +820,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Search/Entity/SearchUserApiProvider.php
|
||||
|
||||
-
|
||||
message: "#^Implicit array creation is not allowed \\- variable \\$items might not exist\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Search/SearchApi.php
|
||||
|
||||
-
|
||||
message: "#^Method Chill\\\\MainBundle\\\\Search\\\\SearchApi\\:\\:buildUnionQuery\\(\\) invoked with 4 parameters, 3 required\\.$#"
|
||||
count: 1
|
||||
@ -935,21 +885,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Security/UserProvider/UserProvider.php
|
||||
|
||||
-
|
||||
message: "#^Implicit array creation is not allowed \\- variable \\$data does not exist\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php
|
||||
|
||||
-
|
||||
message: "#^Implicit array creation is not allowed \\- variable \\$data does not exist\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Serializer/Normalizer/CollectionNormalizer.php
|
||||
|
||||
-
|
||||
message: "#^Implicit array creation is not allowed \\- variable \\$pagination does not exist\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Serializer/Normalizer/CollectionNormalizer.php
|
||||
|
||||
-
|
||||
message: "#^Variable \\$message on left side of \\?\\? always exists and is not nullable\\.$#"
|
||||
count: 1
|
||||
@ -965,11 +900,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php
|
||||
|
||||
-
|
||||
message: "#^Implicit array creation is not allowed \\- variable \\$timelineEntry might not exist\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php
|
||||
|
||||
-
|
||||
message: "#^Method Chill\\\\MainBundle\\\\Timeline\\\\TimelineBuilder\\:\\:getTemplateData\\(\\) should return array but return statement is missing\\.$#"
|
||||
count: 1
|
||||
@ -1045,21 +975,11 @@ parameters:
|
||||
count: 6
|
||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
||||
|
||||
-
|
||||
message: "#^Implicit array creation is not allowed \\- variable \\$matchingTableRowAnswer might not exist\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
||||
|
||||
-
|
||||
message: "#^Variable \\$headers might not be defined\\.$#"
|
||||
count: 2
|
||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
||||
|
||||
-
|
||||
message: "#^Variable \\$matchingTableRowAnswer might not be defined\\.$#"
|
||||
count: 5
|
||||
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
|
||||
|
||||
-
|
||||
message: "#^Variable \\$rawHeaders might not be defined\\.$#"
|
||||
count: 1
|
||||
@ -1095,11 +1015,6 @@ parameters:
|
||||
count: 2
|
||||
path: src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadHousehold.php
|
||||
|
||||
-
|
||||
message: "#^Implicit array creation is not allowed \\- variable \\$persons might not exist\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadHousehold.php
|
||||
|
||||
-
|
||||
message: "#^Variable method call on mixed\\.$#"
|
||||
count: 1
|
||||
@ -1175,31 +1090,11 @@ parameters:
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Export/Aggregator/CountryOfBirthAggregator.php
|
||||
|
||||
-
|
||||
message: "#^Implicit array creation is not allowed \\- variable \\$labels does not exist\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Export/Aggregator/CountryOfBirthAggregator.php
|
||||
|
||||
-
|
||||
message: "#^Variable \\$labels might not be defined\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Export/Aggregator/CountryOfBirthAggregator.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Export/Aggregator/NationalityAggregator.php
|
||||
|
||||
-
|
||||
message: "#^Implicit array creation is not allowed \\- variable \\$labels does not exist\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Export/Aggregator/NationalityAggregator.php
|
||||
|
||||
-
|
||||
message: "#^Variable \\$labels might not be defined\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Export/Aggregator/NationalityAggregator.php
|
||||
|
||||
-
|
||||
message: "#^Anonymous function has an unused use \\$key\\.$#"
|
||||
count: 1
|
||||
@ -1365,21 +1260,11 @@ parameters:
|
||||
count: 3
|
||||
path: src/Bundle/ChillPersonBundle/Search/PersonSearch.php
|
||||
|
||||
-
|
||||
message: "#^Implicit array creation is not allowed \\- variable \\$data might not exist\\.$#"
|
||||
count: 2
|
||||
path: src/Bundle/ChillPersonBundle/Search/PersonSearch.php
|
||||
|
||||
-
|
||||
message: "#^Method Chill\\\\PersonBundle\\\\Search\\\\PersonSearch\\:\\:renderResult\\(\\) should return string but return statement is missing\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Search/PersonSearch.php
|
||||
|
||||
-
|
||||
message: "#^Variable \\$data might not be defined\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Search/PersonSearch.php
|
||||
|
||||
-
|
||||
message: "#^Variable variables are not allowed\\.$#"
|
||||
count: 4
|
||||
@ -1420,16 +1305,6 @@ parameters:
|
||||
count: 2
|
||||
path: src/Bundle/ChillPersonBundle/Templating/Entity/ClosingMotiveRender.php
|
||||
|
||||
-
|
||||
message: "#^Implicit array creation is not allowed \\- variable \\$titles does not exist\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Templating/Entity/SocialActionRender.php
|
||||
|
||||
-
|
||||
message: "#^Implicit array creation is not allowed \\- variable \\$titles does not exist\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillPersonBundle/Templating/Entity/SocialIssueRender.php
|
||||
|
||||
-
|
||||
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
|
||||
count: 1
|
||||
@ -1470,16 +1345,6 @@ parameters:
|
||||
count: 2
|
||||
path: src/Bundle/ChillReportBundle/Export/Export/ReportList.php
|
||||
|
||||
-
|
||||
message: "#^Implicit array creation is not allowed \\- variable \\$scopes might not exist\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillReportBundle/Export/Export/ReportList.php
|
||||
|
||||
-
|
||||
message: "#^Implicit array creation is not allowed \\- variable \\$users might not exist\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillReportBundle/Export/Export/ReportList.php
|
||||
|
||||
-
|
||||
message: "#^Switch condition type \\(Chill\\\\ReportBundle\\\\Export\\\\Export\\\\type\\) does not match case condition 'person_address_country_name' \\(string\\)\\.$#"
|
||||
count: 1
|
||||
@ -1525,16 +1390,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/Bundle/ChillReportBundle/Export/Export/ReportList.php
|
||||
|
||||
-
|
||||
message: "#^Variable \\$scopes might not be defined\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillReportBundle/Export/Export/ReportList.php
|
||||
|
||||
-
|
||||
message: "#^Variable \\$users might not be defined\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillReportBundle/Export/Export/ReportList.php
|
||||
|
||||
-
|
||||
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
|
||||
count: 1
|
||||
@ -1620,21 +1475,11 @@ parameters:
|
||||
count: 1
|
||||
path: src/Bundle/ChillTaskBundle/Timeline/TaskLifeCycleEventTimelineProvider.php
|
||||
|
||||
-
|
||||
message: "#^Implicit array creation is not allowed \\- variable \\$circleIds might not exist\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillTaskBundle/Timeline/TaskLifeCycleEventTimelineProvider.php
|
||||
|
||||
-
|
||||
message: "#^Method Chill\\\\TaskBundle\\\\Timeline\\\\TaskLifeCycleEventTimelineProvider\\:\\:getTransitionByName\\(\\) should return Symfony\\\\Component\\\\Workflow\\\\Transition but return statement is missing\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillTaskBundle/Timeline/TaskLifeCycleEventTimelineProvider.php
|
||||
|
||||
-
|
||||
message: "#^Variable \\$circleIds might not be defined\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillTaskBundle/Timeline/TaskLifeCycleEventTimelineProvider.php
|
||||
|
||||
-
|
||||
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
|
||||
count: 1
|
||||
@ -1690,11 +1535,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/Bundle/ChillThirdPartyBundle/Security/Voter/ThirdPartyVoter.php
|
||||
|
||||
-
|
||||
message: "#^Implicit array creation is not allowed \\- variable \\$data does not exist\\.$#"
|
||||
count: 1
|
||||
path: src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 1
|
||||
|
@ -30,7 +30,9 @@ final class CategoryRender implements ChillEntityRenderInterface
|
||||
{
|
||||
$options = array_merge(self::DEFAULT_ARGS, $options);
|
||||
|
||||
$titles[] = $this->translatableStringHelper->localize($asideActivityCategory->getTitle());
|
||||
$titles = [
|
||||
$this->translatableStringHelper->localize($asideActivityCategory->getTitle()),
|
||||
];
|
||||
|
||||
while ($asideActivityCategory->hasParent()) {
|
||||
$asideActivityCategory = $asideActivityCategory->getParent();
|
||||
|
@ -46,7 +46,11 @@ class ChillCustomFieldsExtension extends Extension implements PrependExtensionIn
|
||||
public function prepend(ContainerBuilder $container)
|
||||
{
|
||||
// add form layout to twig resources
|
||||
$twigConfig['form_themes'][] = 'ChillCustomFieldsBundle:Form:fields.html.twig';
|
||||
$twigConfig = [
|
||||
'form_themes' => [
|
||||
'ChillCustomFieldsBundle:Form:fields.html.twig',
|
||||
],
|
||||
];
|
||||
$container->prependExtensionConfig('twig', $twigConfig);
|
||||
|
||||
//add routes for custom bundle
|
||||
|
@ -181,7 +181,7 @@ class ParticipationController extends AbstractController
|
||||
protected function newMultiple(Request $request)
|
||||
{
|
||||
$participations = $this->handleRequest($request, new Participation(), true);
|
||||
|
||||
$ignoredParticipations = $newParticipations = [];
|
||||
|
||||
foreach ($participations as $i => $participation) {
|
||||
// check for authorization
|
||||
@ -209,7 +209,7 @@ class ParticipationController extends AbstractController
|
||||
|
||||
// this is where the function redirect depending on valid participation
|
||||
|
||||
if (!isset($newParticipations)) {
|
||||
if ([] === $newParticipations) {
|
||||
// if we do not have nay participants, redirect to event view
|
||||
$this->addFlash('error', $this->get('translator')->trans(
|
||||
'None of the requested people may participate '
|
||||
@ -222,22 +222,27 @@ class ParticipationController extends AbstractController
|
||||
// if we have multiple participations, show a form with multiple participations
|
||||
$form = $this->createCreateFormMultiple($newParticipations);
|
||||
|
||||
return $this->render('ChillEventBundle:Participation:new-multiple.html.twig', array(
|
||||
return $this->render(
|
||||
'ChillEventBundle:Participation:new-multiple.html.twig',
|
||||
[
|
||||
'form' => $form->createView(),
|
||||
'participations' => $newParticipations,
|
||||
'ignored_participations' => isset($ignoredParticipations) ? $ignoredParticipations : array()
|
||||
));
|
||||
} else {
|
||||
// if we have only one participation, show the same form than for single participation
|
||||
$form = $this->createCreateForm($participation);
|
||||
'ignored_participations' => $ignoredParticipations
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
return $this->render('ChillEventBundle:Participation:new.html.twig', array(
|
||||
// if we have only one participation, show the same form than for single participation
|
||||
$form = $this->createCreateForm($participation);
|
||||
|
||||
return $this->render(
|
||||
'ChillEventBundle:Participation:new.html.twig',
|
||||
[
|
||||
'form' => $form->createView(),
|
||||
'participation' => $participation,
|
||||
'ignored_participations' => isset($ignoredParticipations) ? $ignoredParticipations : array()
|
||||
));
|
||||
|
||||
}
|
||||
'ignored_participations' => $ignoredParticipations,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -72,6 +72,7 @@ class LoadCountriesCommand extends Command
|
||||
public static function prepareCountryList($languages)
|
||||
{
|
||||
$regionBundle = Intl::getRegionBundle();
|
||||
$countries = [];
|
||||
|
||||
foreach ($languages as $language) {
|
||||
$countries[$language] = $regionBundle->getCountryNames($language);
|
||||
|
@ -63,12 +63,13 @@ class LoadLanguages extends AbstractFixture implements ContainerAwareInterface,
|
||||
}
|
||||
|
||||
/**
|
||||
* prepare names for languages
|
||||
* Prepare names for languages.
|
||||
*
|
||||
* @param string $languageCode
|
||||
* @return string[] languages name indexed by available language code
|
||||
*/
|
||||
private function prepareName($languageCode) {
|
||||
private function prepareName(string $languageCode): array {
|
||||
$names = [];
|
||||
|
||||
foreach ($this->container->getParameter('chill_main.available_languages') as $lang) {
|
||||
$names[$lang] = Intl::getLanguageBundle()->getLanguageName($languageCode);
|
||||
}
|
||||
|
@ -51,8 +51,10 @@ class CenterTransformer implements DataTransformerInterface
|
||||
}
|
||||
}
|
||||
|
||||
$ids = [];
|
||||
|
||||
if ($this->multiple) {
|
||||
$ids = \explode(',', $id);
|
||||
$ids = explode(',', $id);
|
||||
} else {
|
||||
$ids[] = (int) $id;
|
||||
}
|
||||
@ -68,9 +70,9 @@ class CenterTransformer implements DataTransformerInterface
|
||||
|
||||
if ($this->multiple) {
|
||||
return new ArrayCollection($centers);
|
||||
} else {
|
||||
return $centers[0];
|
||||
}
|
||||
|
||||
return $centers[0];
|
||||
}
|
||||
|
||||
public function transform($center)
|
||||
|
@ -139,7 +139,7 @@ class SearchApi
|
||||
return $nq->getResult();
|
||||
}
|
||||
|
||||
private function prepareProviders($rawResults)
|
||||
private function prepareProviders(array $rawResults)
|
||||
{
|
||||
$metadatas = [];
|
||||
foreach ($rawResults as $r) {
|
||||
@ -156,8 +156,10 @@ class SearchApi
|
||||
}
|
||||
}
|
||||
|
||||
private function buildResults($rawResults)
|
||||
private function buildResults(array $rawResults): array
|
||||
{
|
||||
$items = [];
|
||||
|
||||
foreach ($rawResults as $r) {
|
||||
foreach ($this->providers as $k => $p) {
|
||||
if ($p->supportsResult($r['key'], $r['metadata'])) {
|
||||
@ -170,6 +172,6 @@ class SearchApi
|
||||
}
|
||||
}
|
||||
|
||||
return $items ?? [];
|
||||
return $items;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\MainBundle\Serializer\Normalizer;
|
||||
|
||||
use Chill\MainBundle\Entity\Address;
|
||||
@ -12,31 +14,41 @@ class AddressNormalizer implements NormalizerAwareInterface, NormalizerInterface
|
||||
{
|
||||
use NormalizerAwareTrait;
|
||||
|
||||
/**
|
||||
* @param Address $address
|
||||
*/
|
||||
public function normalize($address, string $format = null, array $context = [])
|
||||
{
|
||||
/** @var Address $address */
|
||||
$data['address_id'] = $address->getId();
|
||||
$data['text'] = $address->isNoAddress() ? '' : $address->getStreetNumber().', '.$address->getStreet();
|
||||
$data['street'] = $address->getStreet();
|
||||
$data['streetNumber'] = $address->getStreetNumber();
|
||||
$data['postcode']['id'] = $address->getPostCode()->getId();
|
||||
$data['postcode']['name'] = $address->getPostCode()->getName();
|
||||
$data['postcode']['code'] = $address->getPostCode()->getCode();
|
||||
$data['country']['id'] = $address->getPostCode()->getCountry()->getId();
|
||||
$data['country']['name'] = $address->getPostCode()->getCountry()->getName();
|
||||
$data['country']['code'] = $address->getPostCode()->getCountry()->getCountryCode();
|
||||
$data['floor'] = $address->getFloor();
|
||||
$data['corridor'] = $address->getCorridor();
|
||||
$data['steps'] = $address->getSteps();
|
||||
$data['flat'] = $address->getFlat();
|
||||
$data['buildingName'] = $address->getBuildingName();
|
||||
$data['distribution'] = $address->getDistribution();
|
||||
$data['extra'] = $address->getExtra();
|
||||
$data['validFrom'] = $address->getValidFrom();
|
||||
$data['validTo'] = $address->getValidTo();
|
||||
$data['addressReference'] = $this->normalizer->normalize($address->getAddressReference(), $format, [
|
||||
AbstractNormalizer::GROUPS => ['read']
|
||||
]);
|
||||
$data = [
|
||||
'address_id' => $address->getId(),
|
||||
'text' => $address->isNoAddress() ? '' : $address->getStreetNumber().', '.$address->getStreet(),
|
||||
'street' => $address->getStreet(),
|
||||
'streetNumber' => $address->getStreetNumber(),
|
||||
'postcode' => [
|
||||
'id' => $address->getPostCode()->getId(),
|
||||
'name' => $address->getPostCode()->getName(),
|
||||
'code' => $address->getPostCode()->getCode(),
|
||||
],
|
||||
'country' => [
|
||||
'id' => $address->getPostCode()->getCountry()->getId(),
|
||||
'name' => $address->getPostCode()->getCountry()->getName(),
|
||||
'code' => $address->getPostCode()->getCountry()->getCountryCode(),
|
||||
],
|
||||
'floor' => $address->getFloor(),
|
||||
'corridor' => $address->getCorridor(),
|
||||
'steps' => $address->getSteps(),
|
||||
'flat' => $address->getFlat(),
|
||||
'buildingName' => $address->getBuildingName(),
|
||||
'distribution' => $address->getDistribution(),
|
||||
'extra' => $address->getExtra(),
|
||||
'validFrom' => $address->getValidFrom(),
|
||||
'validTo' => $address->getValidTo(),
|
||||
'addressReference' => $this->normalizer->normalize(
|
||||
$address->getAddressReference(),
|
||||
$format,
|
||||
[AbstractNormalizer::GROUPS => ['read']]
|
||||
),
|
||||
];
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
@ -11,30 +11,28 @@ class CollectionNormalizer implements NormalizerInterface, NormalizerAwareInterf
|
||||
{
|
||||
use NormalizerAwareTrait;
|
||||
|
||||
/**
|
||||
* @param Collection $collection
|
||||
*/
|
||||
public function normalize($collection, string $format = null, array $context = [])
|
||||
{
|
||||
$paginator = $collection->getPaginator();
|
||||
|
||||
return [
|
||||
'count' => $paginator->getTotalItems(),
|
||||
'pagination' => [
|
||||
'first' => $paginator->getCurrentPageFirstItemNumber(),
|
||||
'items_per_page' => $paginator->getItemsPerPage(),
|
||||
'next' => $paginator->hasNextPage() ? $paginator->getNextPage()->generateUrl() : null,
|
||||
'previous' => $paginator->hasPreviousPage() ? $paginator->getPreviousPage()->generateUrl() : null,
|
||||
'more' => $paginator->hasNextPage(),
|
||||
],
|
||||
'results' => $this->normalizer->normalize($collection->getItems(), $format, $context),
|
||||
];
|
||||
}
|
||||
|
||||
public function supportsNormalization($data, string $format = null): bool
|
||||
{
|
||||
return $data instanceof Collection;
|
||||
}
|
||||
|
||||
public function normalize($collection, string $format = null, array $context = [])
|
||||
{
|
||||
/** @var $collection Collection */
|
||||
$paginator = $collection->getPaginator();
|
||||
|
||||
$data['count'] = $paginator->getTotalItems();
|
||||
$pagination['first'] = $paginator->getCurrentPageFirstItemNumber();
|
||||
$pagination['items_per_page'] = $paginator->getItemsPerPage();
|
||||
$pagination['next'] = $paginator->hasNextPage() ?
|
||||
$paginator->getNextPage()->generateUrl() : null;
|
||||
$pagination['previous'] = $paginator->hasPreviousPage() ?
|
||||
$paginator->getPreviousPage()->generateUrl() : null;
|
||||
$pagination['more'] = $paginator->hasNextPage();
|
||||
$data['pagination'] = $pagination;
|
||||
|
||||
// normalize results
|
||||
$data['results'] = $this->normalizer->normalize($collection->getItems(),
|
||||
$format, $context);
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
@ -291,11 +291,12 @@ class TimelineBuilder implements ContainerAwareInterface
|
||||
$entitiesByType[$result['type']][$result['id']], //the entity
|
||||
$context,
|
||||
$args);
|
||||
$timelineEntry['date'] = new \DateTime($result['date']);
|
||||
$timelineEntry['template'] = $data['template'];
|
||||
$timelineEntry['template_data'] = $data['template_data'];
|
||||
|
||||
$timelineEntries[] = $timelineEntry;
|
||||
$timelineEntries[] = [
|
||||
'date' => new \DateTime($result['date']),
|
||||
'template' => $data['template'],
|
||||
'template_data' => $data['template_data']
|
||||
];
|
||||
}
|
||||
|
||||
return $this->container->get('templating')
|
||||
|
@ -959,6 +959,8 @@ EOF
|
||||
$table->setHeaders(array('#', 'label', 'value'));
|
||||
$i = 0;
|
||||
|
||||
$matchingTableRowAnswer = [];
|
||||
|
||||
foreach($answers as $key => $answer) {
|
||||
$table->addRow(array(
|
||||
$i, $answer, $key
|
||||
|
@ -161,8 +161,10 @@ class LoadHousehold extends Fixture implements DependentFixtureInterface
|
||||
\shuffle($this->personIds);
|
||||
}
|
||||
|
||||
private function getRandomPersons(int $min, int $max)
|
||||
private function getRandomPersons(int $min, int $max): array
|
||||
{
|
||||
$persons = [];
|
||||
|
||||
$nb = \random_int($min, $max);
|
||||
|
||||
for ($i=0; $i < $nb; $i++) {
|
||||
@ -172,7 +174,7 @@ class LoadHousehold extends Fixture implements DependentFixtureInterface
|
||||
;
|
||||
}
|
||||
|
||||
return $persons ?? [];
|
||||
return $persons;
|
||||
}
|
||||
|
||||
public function getDependencies()
|
||||
|
@ -143,6 +143,8 @@ final class CountryOfBirthAggregator implements AggregatorInterface, ExportEleme
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
$labels = [];
|
||||
|
||||
if ($data['group_by_level'] === 'country') {
|
||||
$qb = $this->countriesRepository->createQueryBuilder('c');
|
||||
|
||||
@ -153,15 +155,17 @@ final class CountryOfBirthAggregator implements AggregatorInterface, ExportEleme
|
||||
->getResult(\Doctrine\ORM\Query::HYDRATE_SCALAR);
|
||||
|
||||
// initialize array and add blank key for null values
|
||||
$labels[''] = $this->translator->trans('without data');
|
||||
$labels['_header'] = $this->translator->trans('Country of birth');
|
||||
$labels = [
|
||||
'' => $this->translator->trans('without data'),
|
||||
'_header' => $this->translator->trans('Country of birth'),
|
||||
];
|
||||
|
||||
foreach($countries as $row) {
|
||||
$labels[$row['c_countryCode']] = $this->translatableStringHelper->localize($row['c_name']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} elseif ($data['group_by_level'] === 'continent') {
|
||||
|
||||
if ($data['group_by_level'] === 'continent') {
|
||||
$labels = array(
|
||||
'EU' => $this->translator->trans('Europe'),
|
||||
'AS' => $this->translator->trans('Asia'),
|
||||
@ -170,13 +174,12 @@ final class CountryOfBirthAggregator implements AggregatorInterface, ExportEleme
|
||||
'SA' => $this->translator->trans('South America'),
|
||||
'NA' => $this->translator->trans('North America'),
|
||||
'OC' => $this->translator->trans('Oceania'),
|
||||
'' => $this->translator->trans('without data'),
|
||||
'' => $this->translator->trans('without data'),
|
||||
'_header' => $this->translator->trans('Continent of birth')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
return function($value) use ($labels) {
|
||||
return function(string $value) use ($labels): string {
|
||||
return $labels[$value];
|
||||
};
|
||||
|
||||
|
@ -144,6 +144,8 @@ final class NationalityAggregator implements AggregatorInterface, ExportElementV
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
$labels = [];
|
||||
|
||||
if ($data['group_by_level'] === 'country') {
|
||||
$qb = $this->countriesRepository->createQueryBuilder('c');
|
||||
|
||||
@ -154,15 +156,17 @@ final class NationalityAggregator implements AggregatorInterface, ExportElementV
|
||||
->getResult(\Doctrine\ORM\Query::HYDRATE_SCALAR);
|
||||
|
||||
// initialize array and add blank key for null values
|
||||
$labels[''] = $this->translator->trans('without data');
|
||||
$labels['_header'] = $this->translator->trans('Nationality');
|
||||
$labels = [
|
||||
'' => $this->translator->trans('without data'),
|
||||
'_header' => $this->translator->trans('Nationality'),
|
||||
];
|
||||
|
||||
foreach($countries as $row) {
|
||||
$labels[$row['c_countryCode']] = $this->translatableStringHelper->localize($row['c_name']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} elseif ($data['group_by_level'] === 'continent') {
|
||||
|
||||
if ($data['group_by_level'] === 'continent') {
|
||||
$labels = array(
|
||||
'EU' => $this->translator->trans('Europe'),
|
||||
'AS' => $this->translator->trans('Asia'),
|
||||
@ -176,8 +180,7 @@ final class NationalityAggregator implements AggregatorInterface, ExportElementV
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
return function($value) use ($labels) {
|
||||
return function(string $value) use ($labels): string {
|
||||
return $labels[$value];
|
||||
};
|
||||
|
||||
|
@ -263,8 +263,9 @@ class PersonSearch extends AbstractSearch implements HasAdvancedSearchFormInterf
|
||||
|
||||
public function convertTermsToFormData(array $terms)
|
||||
{
|
||||
foreach(['firstname', 'lastname', 'gender', '_default']
|
||||
as $key) {
|
||||
$data = [];
|
||||
|
||||
foreach(['firstname', 'lastname', 'gender', '_default'] as $key) {
|
||||
$data[$key] = $terms[$key] ?? null;
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ class SocialActionRender implements ChillEntityRenderInterface
|
||||
{
|
||||
/** @var $socialAction SocialAction */
|
||||
$options = \array_merge(self::DEFAULT_ARGS, $options);
|
||||
$titles[] = $this->translatableStringHelper->localize($socialAction->getTitle());
|
||||
$titles = [$this->translatableStringHelper->localize($socialAction->getTitle())];
|
||||
|
||||
while ($socialAction->hasParent()) {
|
||||
$socialAction = $socialAction->getParent();
|
||||
|
@ -38,8 +38,7 @@ final class SocialIssueRender implements ChillEntityRenderInterface
|
||||
/** @var $socialIssue SocialIssue */
|
||||
$options = array_merge(self::DEFAULT_ARGS, $options);
|
||||
|
||||
$titles[] = $this->translatableStringHelper
|
||||
->localize($socialIssue->getTitle());
|
||||
$titles = [$this->translatableStringHelper->localize($socialIssue->getTitle())];
|
||||
|
||||
// loop to parent, until root
|
||||
while ($socialIssue->hasParent()) {
|
||||
|
@ -196,9 +196,8 @@ class ReportList implements ListInterface, ExportElementValidatedInterface
|
||||
* @param type $key
|
||||
* @param array $values
|
||||
* @param type $data
|
||||
* @return type
|
||||
*/
|
||||
public function getLabels($key, array $values, $data)
|
||||
public function getLabels($key, array $values, $data): \Closure
|
||||
{
|
||||
switch ($key) {
|
||||
case 'person_birthdate':
|
||||
@ -237,12 +236,13 @@ class ReportList implements ListInterface, ExportElementValidatedInterface
|
||||
;
|
||||
$rows = $qb->getQuery()->getResult(Query::HYDRATE_ARRAY);
|
||||
|
||||
$scopes = [];
|
||||
|
||||
foreach($rows as $row) {
|
||||
$scopes[$row['id']] = $this->translatableStringHelper
|
||||
->localize($row['name']);
|
||||
$scopes[$row['id']] = $this->translatableStringHelper->localize($row['name']);
|
||||
}
|
||||
|
||||
return function($value) use ($scopes) {
|
||||
return function($value) use ($scopes): string {
|
||||
if ($value === '_header') {
|
||||
return 'circle';
|
||||
}
|
||||
@ -258,11 +258,13 @@ class ReportList implements ListInterface, ExportElementValidatedInterface
|
||||
;
|
||||
$rows = $qb->getQuery()->getResult(Query::HYDRATE_ARRAY);
|
||||
|
||||
$users = [];
|
||||
|
||||
foreach($rows as $row) {
|
||||
$users[$row['id']] = $row['username'];
|
||||
}
|
||||
|
||||
return function($value) use ($users) {
|
||||
return function($value) use ($users): string {
|
||||
if ($value === '_header') {
|
||||
return 'user';
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ class TaskLifeCycleEventTimelineProvider implements TimelineProviderInterface
|
||||
|
||||
|
||||
// the parameters
|
||||
$parameters = [];
|
||||
$parameters = $circleIds = [];
|
||||
|
||||
// the clause that we will fill
|
||||
$clause = "{person}.{person_id} = ? AND {task}.{circle} IN ({circle_ids})";
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ThirdPartyBundle\Serializer\Normalizer;
|
||||
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||
@ -20,23 +22,24 @@ class ThirdPartyNormalizer implements NormalizerInterface, NormalizerAwareInterf
|
||||
$this->thirdPartyRender = $thirdPartyRender;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ThirdParty $thirdParty
|
||||
*/
|
||||
public function normalize($thirdParty, string $format = null, array $context = [])
|
||||
{
|
||||
/** @var $thirdParty ThirdParty */
|
||||
$data['type'] = 'thirdparty';
|
||||
$data['text'] = $this->thirdPartyRender->renderString($thirdParty, []);
|
||||
$data['id'] = $thirdParty->getId();
|
||||
$data['kind'] = $thirdParty->getKind();
|
||||
$data['address'] = $this->normalizer->normalize($thirdParty->getAddress(), $format,
|
||||
[ 'address_rendering' => 'short' ]);
|
||||
$data['phonenumber'] = $thirdParty->getTelephone();
|
||||
$data['email'] = $thirdParty->getEmail();
|
||||
$data['isChild'] = $thirdParty->isChild();
|
||||
$data['parent'] = $this->normalizer->normalize($thirdParty->getParent(), $format, $context);
|
||||
$data['civility'] = $this->normalizer->normalize($thirdParty->getCivility(), $format, $context);
|
||||
$data['contactDataAnonymous'] = $thirdParty->isContactDataAnonymous();
|
||||
|
||||
return $data;
|
||||
return [
|
||||
'type' => 'thirdparty',
|
||||
'text' => $this->thirdPartyRender->renderString($thirdParty, []),
|
||||
'id' => $thirdParty->getId(),
|
||||
'kind' => $thirdParty->getKind(),
|
||||
'address' => $this->normalizer->normalize($thirdParty->getAddress(), $format, [ 'address_rendering' => 'short' ]),
|
||||
'phonenumber' => $thirdParty->getTelephone(),
|
||||
'email' => $thirdParty->getEmail(),
|
||||
'isChild' => $thirdParty->isChild(),
|
||||
'parent' => $this->normalizer->normalize($thirdParty->getParent(), $format, $context),
|
||||
'civility' => $this->normalizer->normalize($thirdParty->getCivility(), $format, $context),
|
||||
'contactDataAnonymous' => $thirdParty->isContactDataAnonymous(),
|
||||
];
|
||||
}
|
||||
|
||||
public function supportsNormalization($data, string $format = null)
|
||||
|
Loading…
x
Reference in New Issue
Block a user