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
2da6b746fb
commit
59f9ac25ba
@ -1,5 +1,14 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
|
@ -1,5 +1,14 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\CRUDController;
|
||||
|
@ -1,5 +1,14 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Entity;
|
||||
|
||||
use Chill\MainBundle\Repository\GenderRepository;
|
||||
|
@ -1,8 +1,17 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Entity;
|
||||
|
||||
enum GenderEnum : string
|
||||
enum GenderEnum: string
|
||||
{
|
||||
case MALE = 'man';
|
||||
case FEMALE = 'woman';
|
||||
|
@ -1,5 +1,14 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Entity;
|
||||
|
||||
enum GenderIconEnum: string
|
||||
|
@ -1,5 +1,14 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Form;
|
||||
|
||||
use Chill\MainBundle\Entity\Gender;
|
||||
@ -10,7 +19,6 @@ use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\EnumType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
@ -22,24 +30,19 @@ class GenderType extends AbstractType
|
||||
->add('label', TranslatableStringFormType::class, [
|
||||
'required' => true,
|
||||
])
|
||||
/* ->add('icon', EnumType::class, [
|
||||
'class' => GenderIconEnum::class,
|
||||
'label_html' => true,
|
||||
'expanded' => false,
|
||||
'mapped' => true,
|
||||
])*/
|
||||
->add('icon', ChoiceType::class, [
|
||||
'choices' => GenderIconEnum::cases(),
|
||||
'expanded' => true,
|
||||
'multiple' => false,
|
||||
'mapped' => true,
|
||||
'choice_label' => fn(GenderIconEnum $enum) => '<i class="' . strtolower($enum->value) . '"></i>',
|
||||
'choice_value' => fn(?GenderIconEnum $enum) => null !== $enum ? $enum->value : null,
|
||||
'choice_label' => fn (GenderIconEnum $enum) => '<i class="'.strtolower($enum->value).'"></i>',
|
||||
'choice_value' => fn (?GenderIconEnum $enum) => null !== $enum ? $enum->value : null,
|
||||
'label' => 'gender.admin.Select Gender Icon',
|
||||
'label_html' => true,
|
||||
])
|
||||
->add('genderTranslation', EnumType::class, [
|
||||
'class' => GenderEnum::class,
|
||||
'choice_label' => fn (GenderEnum $enum) => $enum->value,
|
||||
'label' => 'gender.admin.Select Gender Translation',
|
||||
])
|
||||
->add('active', ChoiceType::class, [
|
||||
|
@ -1,15 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Repository;
|
||||
|
||||
use Chill\MainBundle\Entity\Gender;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
use UnexpectedValueException;
|
||||
|
||||
class GenderRepository extends ServiceEntityRepository {
|
||||
class GenderRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Gender::class);
|
||||
|
@ -12,7 +12,6 @@ declare(strict_types=1);
|
||||
namespace Chill\MainBundle\Templating\Entity;
|
||||
|
||||
use Chill\MainBundle\Entity\GenderIconEnum;
|
||||
use Chill\MainBundle\Entity\NewsItem;
|
||||
|
||||
/**
|
||||
* @implements ChillEntityRenderInterface<GenderIconEnum>
|
||||
@ -21,8 +20,7 @@ final readonly class ChillGenderIconRender implements ChillEntityRenderInterface
|
||||
{
|
||||
public function renderBox($icon, array $options): string
|
||||
{
|
||||
return
|
||||
'<i class="'. $icon->value .'"></i>';
|
||||
return '<i class="'.$icon->value.'"></i>';
|
||||
}
|
||||
|
||||
public function renderString($icon, array $options): string
|
||||
|
@ -2,6 +2,13 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\Migrations\Main;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
|
@ -15,6 +15,7 @@ use Chill\MainBundle\DataFixtures\ORM\LoadPostalCodes;
|
||||
use Chill\MainBundle\Entity\Address;
|
||||
use Chill\MainBundle\Entity\Center;
|
||||
use Chill\MainBundle\Entity\Country;
|
||||
use Chill\MainBundle\Entity\GenderEnum;
|
||||
use Chill\MainBundle\Entity\PostalCode;
|
||||
use Chill\MainBundle\Entity\Scope;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
@ -81,7 +82,7 @@ class LoadPeople extends AbstractFixture implements ContainerAwareInterface, Ord
|
||||
|
||||
protected NativeLoader $loader;
|
||||
|
||||
private array $genders = [Person::MALE_GENDER, Person::FEMALE_GENDER, Person::BOTH_GENDER];
|
||||
private array $genders = [GenderEnum::MALE, GenderEnum::FEMALE, GenderEnum::NEUTRAL];
|
||||
|
||||
private array $peoples = [
|
||||
[
|
||||
@ -90,7 +91,7 @@ class LoadPeople extends AbstractFixture implements ContainerAwareInterface, Ord
|
||||
'birthdate' => '1948-12-27',
|
||||
'placeOfBirth' => 'Châteauroux',
|
||||
'nationality' => 'RU',
|
||||
'gender' => Person::MALE_GENDER,
|
||||
'gender' => GenderEnum::MALE,
|
||||
'center' => 'Center A',
|
||||
'accompanyingPeriods' => [
|
||||
[
|
||||
@ -131,7 +132,7 @@ class LoadPeople extends AbstractFixture implements ContainerAwareInterface, Ord
|
||||
'lastName' => 'Depardieu',
|
||||
'firstName' => 'Charline',
|
||||
'birthdate' => '1970-10-15',
|
||||
'gender' => Person::FEMALE_GENDER,
|
||||
'gender' => GenderEnum::FEMALE,
|
||||
'center' => 'Center A',
|
||||
'maritalStatus' => 'ms_legalco',
|
||||
],
|
||||
|
@ -1014,15 +1014,15 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
||||
*
|
||||
* @deprecated Keep for legacy. Used in Chill 1.5 for feminize before icu translations
|
||||
*/
|
||||
/* public function getGenderNumeric()
|
||||
{
|
||||
return match ($this->getGender()) {
|
||||
self::FEMALE_GENDER => 1,
|
||||
self::MALE_GENDER => 0,
|
||||
self::BOTH_GENDER => 2,
|
||||
default => -1,
|
||||
};
|
||||
}*/
|
||||
/* public function getGenderNumeric()
|
||||
{
|
||||
return match ($this->getGender()) {
|
||||
self::FEMALE_GENDER => 1,
|
||||
self::MALE_GENDER => 0,
|
||||
self::BOTH_GENDER => 2,
|
||||
default => -1,
|
||||
};
|
||||
}*/
|
||||
|
||||
public function getHouseholdAddresses(): Collection
|
||||
{
|
||||
|
@ -14,7 +14,6 @@ namespace Chill\PersonBundle\Export\Aggregator\PersonAggregators;
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Chill\MainBundle\Repository\GenderRepository;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Export\Declarations;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
@ -12,17 +12,13 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Export\Filter\PersonFilters;
|
||||
|
||||
use Chill\MainBundle\Entity\Gender;
|
||||
use Chill\MainBundle\Entity\GenderEnum;
|
||||
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Export\Declarations;
|
||||
use Doctrine\ORM\Query\Expr;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\EnumType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
@ -31,9 +27,7 @@ class GenderFilter implements
|
||||
ExportElementValidatedInterface,
|
||||
FilterInterface
|
||||
{
|
||||
public function __construct(private TranslatorInterface $translator, private TranslatableStringHelperInterface $translatableStringHelper)
|
||||
{
|
||||
}
|
||||
public function __construct(private TranslatorInterface $translator, private TranslatableStringHelperInterface $translatableStringHelper) {}
|
||||
|
||||
public function addRole(): ?string
|
||||
{
|
||||
@ -73,7 +67,7 @@ class GenderFilter implements
|
||||
{
|
||||
$builder->add('accepted_genders', EntityType::class, [
|
||||
'class' => Gender::class,
|
||||
'choice_label' => fn(Gender $g) => $this->translatableStringHelper->localize($g->getLabel()),
|
||||
'choice_label' => fn (Gender $g) => $this->translatableStringHelper->localize($g->getLabel()),
|
||||
'multiple' => true,
|
||||
'expanded' => true,
|
||||
]);
|
||||
@ -92,7 +86,7 @@ class GenderFilter implements
|
||||
if ('null' === $g) {
|
||||
$genders[] = $this->translator->trans('Not given');
|
||||
} else {
|
||||
$genders[] = $this->translatableStringHelper($g->getLabel());
|
||||
$genders[] = $this->translatableStringHelper->localize($g->getLabel());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,12 +13,10 @@ namespace Chill\PersonBundle\Form\Type;
|
||||
|
||||
use Chill\MainBundle\Entity\Gender;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
/**
|
||||
|
@ -2,6 +2,13 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\Migrations\Person;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
|
Loading…
x
Reference in New Issue
Block a user