mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
php cs fixes
This commit is contained in:
parent
2708bafb1f
commit
2895638f3b
@ -49,7 +49,6 @@ class ApiWrapper
|
||||
return $data->access_token;
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
$response = $this->client->post('', [
|
||||
'query' => ['realm' => '/partenaire'],
|
||||
|
@ -75,17 +75,15 @@ class PartenaireRomeAppellation
|
||||
],
|
||||
];
|
||||
try {
|
||||
$response = $this->handleRequest(
|
||||
$request,
|
||||
$parameters,
|
||||
$this->client,
|
||||
$this->logger
|
||||
);
|
||||
|
||||
} catch (ClientException $e) {
|
||||
dump($e->getResponse()->getBody()->getContents());
|
||||
}
|
||||
|
||||
$response = $this->handleRequest(
|
||||
$request,
|
||||
$parameters,
|
||||
$this->client,
|
||||
$this->logger
|
||||
);
|
||||
} catch (ClientException $e) {
|
||||
dump($e->getResponse()->getBody()->getContents());
|
||||
}
|
||||
|
||||
return Utils::jsonDecode((string) $response->getBody());
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ class Immersion implements \Stringable
|
||||
* @Assert\NotNull()
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: Person::class)]
|
||||
private ?\Chill\PersonBundle\Entity\Person $person = null;
|
||||
private ?Person $person = null;
|
||||
|
||||
/**
|
||||
* @Assert\NotNull()
|
||||
@ -523,12 +523,11 @@ class Immersion implements \Stringable
|
||||
|
||||
/**
|
||||
* Get duration.
|
||||
*
|
||||
*/
|
||||
public function getDuration()
|
||||
{
|
||||
return $this->duration;
|
||||
// return new \DateInterval($this->duration ?? 'P7D');
|
||||
// return new \DateInterval($this->duration ?? 'P7D');
|
||||
}
|
||||
|
||||
public function getDateEndComputed()
|
||||
|
@ -36,7 +36,7 @@ class ProjetProfessionnel implements \Stringable
|
||||
* @Assert\NotNull()
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: Person::class)]
|
||||
private ?\Chill\PersonBundle\Entity\Person $person = null;
|
||||
private ?Person $person = null;
|
||||
|
||||
/**
|
||||
* @Assert\NotNull()
|
||||
|
@ -24,37 +24,35 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
*/
|
||||
class AddCSPersonToPersonListHelper implements CustomizeListPersonHelperInterface
|
||||
{
|
||||
public function __construct(private readonly TranslatorInterface $translator)
|
||||
{
|
||||
}
|
||||
public function __construct(private readonly TranslatorInterface $translator) {}
|
||||
|
||||
private const CSPERSON_FIELDS = [
|
||||
'dateFinDernierEmploi',
|
||||
/* 'prescripteur__name',
|
||||
'dateFinDernierEmploi',
|
||||
/* 'prescripteur__name',
|
||||
'prescripteur__email',
|
||||
'prescripteur__phone',*/
|
||||
'poleEmploiId',
|
||||
'cafId',
|
||||
'cafInscriptionDate',
|
||||
'dateContratIEJ',
|
||||
'cERInscriptionDate',
|
||||
'pPAEInscriptionDate',
|
||||
'pPAESignataire',
|
||||
'cERSignataire',
|
||||
'nEETCommissionDate',
|
||||
'fSEMaDemarcheCode',
|
||||
'enfantACharge',
|
||||
'nEETEligibilite',
|
||||
'situationProfessionnelle',
|
||||
'poleEmploiId',
|
||||
'cafId',
|
||||
'cafInscriptionDate',
|
||||
'dateContratIEJ',
|
||||
'cERInscriptionDate',
|
||||
'pPAEInscriptionDate',
|
||||
'pPAESignataire',
|
||||
'cERSignataire',
|
||||
'nEETCommissionDate',
|
||||
'fSEMaDemarcheCode',
|
||||
'enfantACharge',
|
||||
'nEETEligibilite',
|
||||
'situationProfessionnelle',
|
||||
];
|
||||
|
||||
public function alterKeys(array $existing): array
|
||||
{
|
||||
$ressources = array_map(static fn ($key) => 'ressources__' . $key, CSPerson::RESSOURCES);
|
||||
$moyenTransport = array_map(static fn ($key) => 'moyen_transport__' . $key, CSPerson::MOBILITE_MOYEN_TRANSPORT);
|
||||
$accompagnements = array_map(static fn ($key) => 'accompagnements__' . $key, CSPerson::ACCOMPAGNEMENTS);
|
||||
$permisConduire = array_map(static fn ($key) => 'permis_conduire__' . $key, CSPerson::PERMIS_CONDUIRE);
|
||||
$typeContrat = array_map(static fn ($key) => 'type_contrat__' . $key, CSPerson::TYPE_CONTRAT);
|
||||
$ressources = array_map(static fn ($key) => 'ressources__'.$key, CSPerson::RESSOURCES);
|
||||
$moyenTransport = array_map(static fn ($key) => 'moyen_transport__'.$key, CSPerson::MOBILITE_MOYEN_TRANSPORT);
|
||||
$accompagnements = array_map(static fn ($key) => 'accompagnements__'.$key, CSPerson::ACCOMPAGNEMENTS);
|
||||
$permisConduire = array_map(static fn ($key) => 'permis_conduire__'.$key, CSPerson::PERMIS_CONDUIRE);
|
||||
$typeContrat = array_map(static fn ($key) => 'type_contrat__'.$key, CSPerson::TYPE_CONTRAT);
|
||||
|
||||
return [
|
||||
...$existing,
|
||||
@ -76,129 +74,124 @@ class AddCSPersonToPersonListHelper implements CustomizeListPersonHelperInterfac
|
||||
$qb->addSelect(sprintf('cs_person.%s as %s', $f, $f));
|
||||
}
|
||||
|
||||
/* $qb->addSelect('cs_person.situationProfessionnelle as situation_prof');
|
||||
/* $qb->addSelect('cs_person.situationProfessionnelle as situation_prof');
|
||||
|
||||
$qb->addSelect('cs_person.nEETEligibilite as nEETEligibilite');*/
|
||||
$qb->addSelect('cs_person.nEETEligibilite as nEETEligibilite');*/
|
||||
|
||||
$i = 0;
|
||||
|
||||
foreach (CSPerson::RESSOURCES as $key)
|
||||
{
|
||||
$qb->addSelect("JSONB_EXISTS_IN_ARRAY(cs_person.ressources, :param_$i) AS ressources__" . $key)
|
||||
foreach (CSPerson::RESSOURCES as $key) {
|
||||
$qb->addSelect("JSONB_EXISTS_IN_ARRAY(cs_person.ressources, :param_{$i}) AS ressources__".$key)
|
||||
->setParameter('param_'.$i, $key);
|
||||
++$i;
|
||||
}
|
||||
|
||||
foreach(CSPerson::MOBILITE_MOYEN_TRANSPORT as $key)
|
||||
{
|
||||
$qb->addSelect("JSONB_EXISTS_IN_ARRAY(cs_person.mobiliteMoyenDeTransport, :param_$i) AS moyen_transport__" . $key)
|
||||
foreach (CSPerson::MOBILITE_MOYEN_TRANSPORT as $key) {
|
||||
$qb->addSelect("JSONB_EXISTS_IN_ARRAY(cs_person.mobiliteMoyenDeTransport, :param_{$i}) AS moyen_transport__".$key)
|
||||
->setParameter('param_'.$i, $key);
|
||||
++$i;
|
||||
}
|
||||
|
||||
foreach(CSPerson::TYPE_CONTRAT as $key)
|
||||
{
|
||||
$qb->addSelect("JSONB_EXISTS_IN_ARRAY(cs_person.typeContrat, :param_$i) AS type_contrat__" . $key)
|
||||
foreach (CSPerson::TYPE_CONTRAT as $key) {
|
||||
$qb->addSelect("JSONB_EXISTS_IN_ARRAY(cs_person.typeContrat, :param_{$i}) AS type_contrat__".$key)
|
||||
->setParameter('param_'.$i, $key);
|
||||
++$i;
|
||||
}
|
||||
|
||||
foreach (CSPerson::ACCOMPAGNEMENTS as $key)
|
||||
{
|
||||
$qb->addSelect("JSONB_EXISTS_IN_ARRAY(cs_person.accompagnement, :param_$i) AS accompagnements__" . $key)
|
||||
foreach (CSPerson::ACCOMPAGNEMENTS as $key) {
|
||||
$qb->addSelect("JSONB_EXISTS_IN_ARRAY(cs_person.accompagnement, :param_{$i}) AS accompagnements__".$key)
|
||||
->setParameter('param_'.$i, $key);
|
||||
++$i;
|
||||
}
|
||||
|
||||
foreach (CSPerson::PERMIS_CONDUIRE as $key)
|
||||
{
|
||||
$qb->addSelect("JSONB_EXISTS_IN_ARRAY(cs_person.permisConduire, :param_$i) AS permis_conduire__" . $key)
|
||||
foreach (CSPerson::PERMIS_CONDUIRE as $key) {
|
||||
$qb->addSelect("JSONB_EXISTS_IN_ARRAY(cs_person.permisConduire, :param_{$i}) AS permis_conduire__".$key)
|
||||
->setParameter('param_'.$i, $key);
|
||||
++$i;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function getLabels(string $key, array $values, array $data): ?callable
|
||||
{
|
||||
switch ($key) {
|
||||
case str_contains($key, '__'):
|
||||
return function (string|bool|null $value) use ($key): string {
|
||||
if ('_header' === $value) {
|
||||
[$domain, $v] = explode('__', $key);
|
||||
return 'export.list.cs_person.' . $domain . '.' . $v;
|
||||
}
|
||||
switch ($key) {
|
||||
case str_contains($key, '__'):
|
||||
return function (string|bool|null $value) use ($key): string {
|
||||
if ('_header' === $value) {
|
||||
[$domain, $v] = explode('__', $key);
|
||||
|
||||
if ('1' === $value || true === $value || 1 === $value || 't' === $value) {
|
||||
return 'x';
|
||||
}
|
||||
return 'export.list.cs_person.'.$domain.'.'.$v;
|
||||
}
|
||||
|
||||
if ('1' === $value || true === $value || 1 === $value || 't' === $value) {
|
||||
return 'x';
|
||||
}
|
||||
|
||||
return '';
|
||||
};
|
||||
case 'nEETEligibilite':
|
||||
return function (string|bool|null $value): string {
|
||||
if ('_header' === $value) {
|
||||
return 'export.list.cs_person.neet_eligibility';
|
||||
}
|
||||
|
||||
if ('1' === $value || true === $value || 1 === $value || 't' === $value) {
|
||||
return 'x';
|
||||
}
|
||||
|
||||
return '';
|
||||
};
|
||||
case 'situationProfessionnelle':
|
||||
return function ($value) {
|
||||
if ('_header' === $value) {
|
||||
return 'export.list.cs_person.situation_professionelle';
|
||||
}
|
||||
|
||||
return $value;
|
||||
};
|
||||
case 'cerinscriptiondate':
|
||||
case 'ppaeinscriptiondate':
|
||||
case 'neetcommissiondate':
|
||||
case 'findernieremploidate':
|
||||
case 'cafinscriptiondate':
|
||||
case 'contratiejdate':
|
||||
return function ($value) use ($key) {
|
||||
if ('_header' === $value) {
|
||||
return $this->translator->trans($key);
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
};
|
||||
case 'nEETEligibilite':
|
||||
return function (string|bool|null $value) use ($key): string {
|
||||
if ('_header' === $value) {
|
||||
return 'export.list.cs_person.neet_eligibility';
|
||||
}
|
||||
}
|
||||
// warning: won't work with DateTimeImmutable as we reset time a few lines later
|
||||
$date = \DateTime::createFromFormat('Y-m-d', $value);
|
||||
$hasTime = false;
|
||||
|
||||
if ('1' === $value || true === $value || 1 === $value || 't' === $value) {
|
||||
return 'x';
|
||||
}
|
||||
if (false === $date) {
|
||||
$date = \DateTime::createFromFormat('Y-m-d H:i:s', $value);
|
||||
$hasTime = true;
|
||||
}
|
||||
|
||||
return '';
|
||||
};
|
||||
case 'situationProfessionnelle':
|
||||
return function ($value) use ($key) {
|
||||
if ('_header' === $value) {
|
||||
return 'export.list.cs_person.situation_professionelle';
|
||||
}
|
||||
// check that the creation could occur.
|
||||
if (false === $date) {
|
||||
throw new \Exception(sprintf('The value %s could not be converted to %s', $value, \DateTime::class));
|
||||
}
|
||||
|
||||
return $value;
|
||||
};
|
||||
case 'cerinscriptiondate':
|
||||
case 'ppaeinscriptiondate':
|
||||
case 'neetcommissiondate':
|
||||
case 'findernieremploidate':
|
||||
case 'cafinscriptiondate':
|
||||
case 'contratiejdate':
|
||||
return function ($value) use ($key) {
|
||||
if ('_header' === $value) {
|
||||
return $this->translator->trans($key);
|
||||
}
|
||||
if (!$hasTime) {
|
||||
$date->setTime(0, 0, 0);
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
// warning: won't work with DateTimeImmutable as we reset time a few lines later
|
||||
$date = \DateTime::createFromFormat('Y-m-d', $value);
|
||||
$hasTime = false;
|
||||
return $date;
|
||||
};
|
||||
|
||||
if (false === $date) {
|
||||
$date = \DateTime::createFromFormat('Y-m-d H:i:s', $value);
|
||||
$hasTime = true;
|
||||
}
|
||||
default:
|
||||
// for fields which are associated with person
|
||||
return function ($value) use ($key) {
|
||||
if ('_header' === $value) {
|
||||
return $this->translator->trans($key);
|
||||
}
|
||||
|
||||
// check that the creation could occur.
|
||||
if (false === $date) {
|
||||
throw new \Exception(sprintf('The value %s could not be converted to %s', $value, \DateTime::class));
|
||||
}
|
||||
|
||||
if (!$hasTime) {
|
||||
$date->setTime(0, 0, 0);
|
||||
}
|
||||
|
||||
return $date;
|
||||
};
|
||||
|
||||
default:
|
||||
// for fields which are associated with person
|
||||
return function ($value) use ($key) {
|
||||
if ('_header' === $value) {
|
||||
return $this->translator->trans($key);
|
||||
}
|
||||
|
||||
return $value;
|
||||
};
|
||||
}
|
||||
return $value;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ class ListCV implements ListInterface, ExportElementValidatedInterface
|
||||
->add('fields', ChoiceType::class, [
|
||||
'multiple' => true,
|
||||
'expanded' => true,
|
||||
// 'choices_as_values' => true,
|
||||
// 'choices_as_values' => true,
|
||||
'label' => 'Fields to include in export',
|
||||
'choices' => array_combine($this->getFields(), $this->getFields()),
|
||||
'data' => array_combine($this->getFields(), $this->getFields()),
|
||||
|
@ -105,7 +105,7 @@ class ListFrein implements ListInterface, ExportElementValidatedInterface
|
||||
->add('fields', ChoiceType::class, [
|
||||
'multiple' => true,
|
||||
'expanded' => true,
|
||||
// 'choices_as_values' => true,
|
||||
// 'choices_as_values' => true,
|
||||
'label' => 'Fields to include in export',
|
||||
'choices' => array_combine($this->getFields(), $this->getFields()),
|
||||
'data' => array_combine($this->getFields(), $this->getFields()),
|
||||
|
@ -110,7 +110,7 @@ class ListProjetProfessionnel implements ListInterface, ExportElementValidatedIn
|
||||
->add('fields', ChoiceType::class, [
|
||||
'multiple' => true,
|
||||
'expanded' => true,
|
||||
// 'choices_as_values' => true,
|
||||
// 'choices_as_values' => true,
|
||||
'label' => 'Fields to include in export',
|
||||
'choice_label' => fn ($key) => str_replace('__', '.', (string) $key),
|
||||
'choices' => array_combine($this->getFields(), $this->getFields()),
|
||||
|
Loading…
x
Reference in New Issue
Block a user