mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Fix DI on other services depending on updated repositories.
This commit is contained in:
parent
81e8a4562b
commit
92b4adc113
@ -19,26 +19,18 @@
|
|||||||
|
|
||||||
namespace Chill\MainBundle\Form\Type\DataTransformer;
|
namespace Chill\MainBundle\Form\Type\DataTransformer;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Entity\Center;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Symfony\Component\Form\DataTransformerInterface;
|
use Symfony\Component\Form\DataTransformerInterface;
|
||||||
use Doctrine\Persistence\ObjectManager;
|
|
||||||
use Symfony\Component\Form\Exception\TransformationFailedException;
|
use Symfony\Component\Form\Exception\TransformationFailedException;
|
||||||
|
|
||||||
/**
|
|
||||||
* Transform a center object to his id, and vice-versa
|
|
||||||
*
|
|
||||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
|
||||||
*/
|
|
||||||
class CenterTransformer implements DataTransformerInterface
|
class CenterTransformer implements DataTransformerInterface
|
||||||
{
|
{
|
||||||
/**
|
private EntityManagerInterface $em;
|
||||||
*
|
|
||||||
* @var ObjectManager
|
public function __construct(EntityManagerInterface $em)
|
||||||
*/
|
|
||||||
private $om;
|
|
||||||
|
|
||||||
public function __construct(ObjectManager $om)
|
|
||||||
{
|
{
|
||||||
$this->om = $om;
|
$this->em = $em;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function reverseTransform($id)
|
public function reverseTransform($id)
|
||||||
@ -46,15 +38,17 @@ class CenterTransformer implements DataTransformerInterface
|
|||||||
if ($id === NULL) {
|
if ($id === NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
$center = $this->om->getRepository('ChillMainBundle:Center')
|
$center = $this
|
||||||
->find($id);
|
->em
|
||||||
|
->getRepository(Center::class)
|
||||||
|
->find($id);
|
||||||
|
|
||||||
if ($center === NULL) {
|
if ($center === NULL) {
|
||||||
throw new TransformationFailedException(sprintf(
|
throw new TransformationFailedException(sprintf(
|
||||||
'No center found with id %d', $id));
|
'No center found with id %d', $id));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $center;
|
return $center;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +57,7 @@ class CenterTransformer implements DataTransformerInterface
|
|||||||
if ($center === NULL) {
|
if ($center === NULL) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $center->getId();
|
return $center->getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,28 +24,20 @@ use Symfony\Component\Form\DataTransformerInterface;
|
|||||||
use Symfony\Component\Form\Exception\TransformationFailedException;
|
use Symfony\Component\Form\Exception\TransformationFailedException;
|
||||||
use Doctrine\Persistence\ObjectManager;
|
use Doctrine\Persistence\ObjectManager;
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
|
||||||
class MultipleObjectsToIdTransformer implements DataTransformerInterface
|
class MultipleObjectsToIdTransformer implements DataTransformerInterface
|
||||||
{
|
{
|
||||||
/**
|
private EntityManagerInterface $em;
|
||||||
* @var ObjectManager
|
|
||||||
*/
|
private ?string $class;
|
||||||
private $em;
|
|
||||||
|
public function __construct(EntityManagerInterface $em, ?string $class = null)
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $class;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ObjectManager $em
|
|
||||||
*/
|
|
||||||
public function __construct(ObjectManager $em, $class)
|
|
||||||
{
|
{
|
||||||
$this->em = $em;
|
$this->em = $em;
|
||||||
$this->class = $class;
|
$this->class = $class;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transforms an object (use) to a string (id).
|
* Transforms an object (use) to a string (id).
|
||||||
*
|
*
|
||||||
|
@ -20,28 +20,20 @@
|
|||||||
|
|
||||||
namespace Chill\MainBundle\Form\Type\DataTransformer;
|
namespace Chill\MainBundle\Form\Type\DataTransformer;
|
||||||
|
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Symfony\Component\Form\DataTransformerInterface;
|
use Symfony\Component\Form\DataTransformerInterface;
|
||||||
use Symfony\Component\Form\Exception\TransformationFailedException;
|
use Symfony\Component\Form\Exception\TransformationFailedException;
|
||||||
use Doctrine\Persistence\ObjectManager;
|
use Doctrine\Persistence\ObjectManager;
|
||||||
|
|
||||||
class ObjectToIdTransformer implements DataTransformerInterface
|
class ObjectToIdTransformer implements DataTransformerInterface
|
||||||
{
|
{
|
||||||
/**
|
private EntityManagerInterface $em;
|
||||||
* @var ObjectManager
|
|
||||||
*/
|
|
||||||
private $om;
|
|
||||||
|
|
||||||
/**
|
private ?string $class;
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $class;
|
|
||||||
|
|
||||||
/**
|
public function __construct(EntityManagerInterface $em, ?string $class = null)
|
||||||
* @param ObjectManager $om
|
|
||||||
*/
|
|
||||||
public function __construct(ObjectManager $om, $class)
|
|
||||||
{
|
{
|
||||||
$this->om = $om;
|
$this->em = $em;
|
||||||
$this->class = $class;
|
$this->class = $class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +65,7 @@ class ObjectToIdTransformer implements DataTransformerInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$object = $this->om
|
$object = $this->em
|
||||||
->getRepository($this->class)
|
->getRepository($this->class)
|
||||||
->find($id)
|
->find($id)
|
||||||
;
|
;
|
||||||
|
@ -19,41 +19,28 @@
|
|||||||
|
|
||||||
namespace Chill\MainBundle\Form\Type\DataTransformer;
|
namespace Chill\MainBundle\Form\Type\DataTransformer;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Entity\Scope;
|
||||||
use Symfony\Component\Form\DataTransformerInterface;
|
use Symfony\Component\Form\DataTransformerInterface;
|
||||||
use Doctrine\Persistence\ObjectManager;
|
use Doctrine\Persistence\ObjectManager;
|
||||||
use Symfony\Component\Form\Exception\TransformationFailedException;
|
use Symfony\Component\Form\Exception\TransformationFailedException;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
|
||||||
*/
|
|
||||||
class ScopeTransformer implements DataTransformerInterface
|
class ScopeTransformer implements DataTransformerInterface
|
||||||
{
|
{
|
||||||
/**
|
private EntityManagerInterface $em;
|
||||||
*
|
|
||||||
* @var ObjectManager
|
public function __construct(EntityManagerInterface $em)
|
||||||
*/
|
|
||||||
protected $om;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @var TranslatableStringHelper
|
|
||||||
*/
|
|
||||||
protected $helper;
|
|
||||||
|
|
||||||
public function __construct(ObjectManager $om)
|
|
||||||
{
|
{
|
||||||
$this->om = $om;
|
$this->em = $em;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function transform($scope)
|
public function transform($scope)
|
||||||
{
|
{
|
||||||
if ($scope === NULL) {
|
if ($scope === NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $scope->getId();
|
return $scope->getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,15 +49,17 @@ class ScopeTransformer implements DataTransformerInterface
|
|||||||
if ($id == NULL) {
|
if ($id == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope = $this->om->getRepository('ChillMainBundle:Scope')
|
$scope = $this
|
||||||
->find($id);
|
->em
|
||||||
|
->getRepository(Scope::class)
|
||||||
|
->find($id);
|
||||||
|
|
||||||
if ($scope === NULL) {
|
if ($scope === NULL) {
|
||||||
throw new TransformationFailedException(sprintf("The scope with id "
|
throw new TransformationFailedException(sprintf("The scope with id "
|
||||||
. "'%d' were not found", $id));
|
. "'%d' were not found", $id));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $scope;
|
return $scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ use Chill\MainBundle\Entity\Center;
|
|||||||
use Chill\MainBundle\Entity\Scope;
|
use Chill\MainBundle\Entity\Scope;
|
||||||
use Chill\MainBundle\Entity\User;
|
use Chill\MainBundle\Entity\User;
|
||||||
use Chill\MainBundle\Form\DataMapper\ScopePickerDataMapper;
|
use Chill\MainBundle\Form\DataMapper\ScopePickerDataMapper;
|
||||||
|
use Chill\MainBundle\Repository\ScopeRepository;
|
||||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
@ -60,7 +61,7 @@ class ScopePickerType extends AbstractType
|
|||||||
protected $tokenStorage;
|
protected $tokenStorage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var EntityRepository
|
* @var ScopeRepository
|
||||||
*/
|
*/
|
||||||
protected $scopeRepository;
|
protected $scopeRepository;
|
||||||
|
|
||||||
@ -72,7 +73,7 @@ class ScopePickerType extends AbstractType
|
|||||||
public function __construct(
|
public function __construct(
|
||||||
AuthorizationHelper $authorizationHelper,
|
AuthorizationHelper $authorizationHelper,
|
||||||
TokenStorageInterface $tokenStorage,
|
TokenStorageInterface $tokenStorage,
|
||||||
EntityRepository $scopeRepository,
|
ScopeRepository $scopeRepository,
|
||||||
TranslatableStringHelper $translatableStringHelper
|
TranslatableStringHelper $translatableStringHelper
|
||||||
) {
|
) {
|
||||||
$this->authorizationHelper = $authorizationHelper;
|
$this->authorizationHelper = $authorizationHelper;
|
||||||
|
@ -25,6 +25,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
|||||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
use Chill\MainBundle\Entity\User;
|
use Chill\MainBundle\Entity\User;
|
||||||
|
use Chill\MainBundle\Repository\UserRepository;
|
||||||
use Symfony\Component\Security\Core\Role\RoleHierarchyInterface;
|
use Symfony\Component\Security\Core\Role\RoleHierarchyInterface;
|
||||||
use Symfony\Component\Security\Core\Role\Role;
|
use Symfony\Component\Security\Core\Role\Role;
|
||||||
|
|
||||||
@ -53,16 +54,12 @@ class UserPickerType extends AbstractType
|
|||||||
*/
|
*/
|
||||||
protected $tokenStorage;
|
protected $tokenStorage;
|
||||||
|
|
||||||
/**
|
protected UserRepository $userRepository;
|
||||||
*
|
|
||||||
* @var \Chill\MainBundle\Repository\UserRepository
|
|
||||||
*/
|
|
||||||
protected $userRepository;
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
AuthorizationHelper $authorizationHelper,
|
AuthorizationHelper $authorizationHelper,
|
||||||
TokenStorageInterface $tokenStorage,
|
TokenStorageInterface $tokenStorage,
|
||||||
EntityRepository $userRepository
|
UserRepository $userRepository
|
||||||
) {
|
) {
|
||||||
$this->authorizationHelper = $authorizationHelper;
|
$this->authorizationHelper = $authorizationHelper;
|
||||||
$this->tokenStorage = $tokenStorage;
|
$this->tokenStorage = $tokenStorage;
|
||||||
|
@ -6,12 +6,25 @@ services:
|
|||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
|
|
||||||
|
Chill\MainBundle\Repository\:
|
||||||
|
resource: '../Repository/'
|
||||||
|
autowire: true
|
||||||
|
autoconfigure: true
|
||||||
|
|
||||||
Chill\MainBundle\Serializer\Normalizer\:
|
Chill\MainBundle\Serializer\Normalizer\:
|
||||||
resource: '../Serializer/Normalizer'
|
resource: '../Serializer/Normalizer'
|
||||||
|
autoconfigure: true
|
||||||
autowire: true
|
autowire: true
|
||||||
tags:
|
tags:
|
||||||
- { name: 'serializer.normalizer', priority: 64 }
|
- { name: 'serializer.normalizer', priority: 64 }
|
||||||
|
|
||||||
|
Chill\MainBundle\Form\Type\:
|
||||||
|
resource: '../Form/Type'
|
||||||
|
autoconfigure: true
|
||||||
|
autowire: true
|
||||||
|
tags:
|
||||||
|
- { name: form.type }
|
||||||
|
|
||||||
Chill\MainBundle\Doctrine\Event\:
|
Chill\MainBundle\Doctrine\Event\:
|
||||||
resource: '../Doctrine/Event/'
|
resource: '../Doctrine/Event/'
|
||||||
autowire: true
|
autowire: true
|
||||||
|
@ -65,8 +65,6 @@ services:
|
|||||||
|
|
||||||
chill.main.form.choice_loader.postal_code:
|
chill.main.form.choice_loader.postal_code:
|
||||||
class: Chill\MainBundle\Form\ChoiceLoader\PostalCodeChoiceLoader
|
class: Chill\MainBundle\Form\ChoiceLoader\PostalCodeChoiceLoader
|
||||||
arguments:
|
|
||||||
- '@Chill\MainBundle\Repository\PostalCodeRepository'
|
|
||||||
|
|
||||||
chill.main.form.type.export:
|
chill.main.form.type.export:
|
||||||
class: Chill\MainBundle\Form\Type\Export\ExportType
|
class: Chill\MainBundle\Form\Type\Export\ExportType
|
||||||
@ -98,32 +96,10 @@ services:
|
|||||||
arguments:
|
arguments:
|
||||||
- '@Chill\MainBundle\Export\ExportManager'
|
- '@Chill\MainBundle\Export\ExportManager'
|
||||||
|
|
||||||
chill.main.form.date_type:
|
|
||||||
class: Chill\MainBundle\Form\Type\ChillDateType
|
|
||||||
tags:
|
|
||||||
- { name: form.type }
|
|
||||||
|
|
||||||
chill.main.form.pick_user_type:
|
|
||||||
class: Chill\MainBundle\Form\Type\UserPickerType
|
|
||||||
arguments:
|
|
||||||
- "@chill.main.security.authorization.helper"
|
|
||||||
- "@security.token_storage"
|
|
||||||
- "@chill.main.user_repository"
|
|
||||||
tags:
|
|
||||||
- { name: form.type }
|
|
||||||
|
|
||||||
chill.main.form.pick_scope_type:
|
|
||||||
class: Chill\MainBundle\Form\Type\ScopePickerType
|
|
||||||
arguments:
|
|
||||||
- "@chill.main.security.authorization.helper"
|
|
||||||
- "@security.token_storage"
|
|
||||||
- "@chill.main.scope_repository"
|
|
||||||
- "@chill.main.helper.translatable_string"
|
|
||||||
tags:
|
|
||||||
- { name: form.type }
|
|
||||||
|
|
||||||
chill.main.form.advanced_search_type:
|
chill.main.form.advanced_search_type:
|
||||||
class: Chill\MainBundle\Form\AdvancedSearchType
|
class: Chill\MainBundle\Form\AdvancedSearchType
|
||||||
|
autowire: true
|
||||||
|
autoconfigure: true
|
||||||
arguments:
|
arguments:
|
||||||
- "@chill_main.search_provider"
|
- "@chill_main.search_provider"
|
||||||
tags:
|
tags:
|
||||||
|
@ -32,9 +32,8 @@ services:
|
|||||||
- { name: twig.extension }
|
- { name: twig.extension }
|
||||||
|
|
||||||
Chill\MainBundle\Templating\Entity\CommentRender:
|
Chill\MainBundle\Templating\Entity\CommentRender:
|
||||||
arguments:
|
autoconfigure: true
|
||||||
- '@chill.main.user_repository'
|
autowire: true
|
||||||
- '@Symfony\Component\Templating\EngineInterface'
|
|
||||||
tags:
|
tags:
|
||||||
- { name: 'chill.render_entity' }
|
- { name: 'chill.render_entity' }
|
||||||
|
|
||||||
|
@ -24,28 +24,17 @@ use Doctrine\ORM\QueryBuilder;
|
|||||||
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
||||||
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
||||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||||
use Symfony\Component\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
/**
|
final class AgeAggregator implements AggregatorInterface, ExportElementValidatedInterface
|
||||||
*
|
|
||||||
*
|
|
||||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
|
||||||
*/
|
|
||||||
class AgeAggregator implements AggregatorInterface,
|
|
||||||
ExportElementValidatedInterface
|
|
||||||
{
|
{
|
||||||
/**
|
private TranslatorInterface $translator;
|
||||||
*
|
|
||||||
* @var
|
public function __construct(TranslatorInterface $translator)
|
||||||
*/
|
|
||||||
protected $translator;
|
|
||||||
|
|
||||||
public function __construct($translator)
|
|
||||||
{
|
{
|
||||||
$this->translator = $translator;
|
$this->translator = $translator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function addRole()
|
public function addRole()
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
@ -29,40 +29,23 @@ use Chill\MainBundle\Util\CountriesInfo;
|
|||||||
use Symfony\Component\Security\Core\Role\Role;
|
use Symfony\Component\Security\Core\Role\Role;
|
||||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||||
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
||||||
|
use Chill\MainBundle\Repository\CountryRepository;
|
||||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
|
|
||||||
|
final class CountryOfBirthAggregator implements AggregatorInterface, ExportElementValidatedInterface
|
||||||
/**
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
|
||||||
*/
|
|
||||||
class CountryOfBirthAggregator implements AggregatorInterface,
|
|
||||||
ExportElementValidatedInterface
|
|
||||||
{
|
{
|
||||||
/**
|
private CountryRepository $countriesRepository;
|
||||||
*
|
|
||||||
* @var EntityRepository
|
|
||||||
*/
|
|
||||||
protected $countriesRepository;
|
|
||||||
|
|
||||||
/**
|
private TranslatableStringHelper $translatableStringHelper;
|
||||||
*
|
|
||||||
* @var TranslatableStringHelper
|
|
||||||
*/
|
|
||||||
protected $translatableStringHelper;
|
|
||||||
|
|
||||||
/**
|
private TranslatorInterface $translator;
|
||||||
*
|
|
||||||
* @var TranslatorInterface
|
|
||||||
*/
|
|
||||||
protected $translator;
|
|
||||||
|
|
||||||
public function __construct(EntityRepository $countriesRepository,
|
public function __construct(
|
||||||
TranslatableStringHelper $translatableStringHelper,
|
CountryRepository $countriesRepository,
|
||||||
TranslatorInterface $translator)
|
TranslatableStringHelper $translatableStringHelper,
|
||||||
{
|
TranslatorInterface $translator
|
||||||
|
) {
|
||||||
$this->countriesRepository = $countriesRepository;
|
$this->countriesRepository = $countriesRepository;
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
$this->translatableStringHelper = $translatableStringHelper;
|
||||||
$this->translator = $translator;
|
$this->translator = $translator;
|
||||||
@ -73,7 +56,6 @@ class CountryOfBirthAggregator implements AggregatorInterface,
|
|||||||
return 'person';
|
return 'person';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
{
|
{
|
||||||
$builder->add('group_by_level', ChoiceType::class, array(
|
$builder->add('group_by_level', ChoiceType::class, array(
|
||||||
|
@ -26,31 +26,20 @@ use Symfony\Component\Translation\TranslatorInterface;
|
|||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
|
|
||||||
/**
|
final class GenderAggregator implements AggregatorInterface
|
||||||
*
|
|
||||||
*
|
|
||||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
|
||||||
*/
|
|
||||||
class GenderAggregator implements AggregatorInterface
|
|
||||||
{
|
{
|
||||||
|
private TranslatorInterface $translator;
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @var TranslatorInterface
|
|
||||||
*/
|
|
||||||
protected $translator;
|
|
||||||
|
|
||||||
public function __construct(TranslatorInterface $translator)
|
public function __construct(TranslatorInterface $translator)
|
||||||
{
|
{
|
||||||
$this->translator = $translator;
|
$this->translator = $translator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn()
|
public function applyOn()
|
||||||
{
|
{
|
||||||
return Declarations::PERSON_TYPE;
|
return Declarations::PERSON_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -29,39 +29,23 @@ use Chill\MainBundle\Util\CountriesInfo;
|
|||||||
use Symfony\Component\Security\Core\Role\Role;
|
use Symfony\Component\Security\Core\Role\Role;
|
||||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||||
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
||||||
|
use Chill\MainBundle\Repository\CountryRepository;
|
||||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
|
|
||||||
/**
|
final class NationalityAggregator implements AggregatorInterface, ExportElementValidatedInterface
|
||||||
*
|
|
||||||
*
|
|
||||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
|
||||||
*/
|
|
||||||
class NationalityAggregator implements AggregatorInterface,
|
|
||||||
ExportElementValidatedInterface
|
|
||||||
{
|
{
|
||||||
/**
|
private CountryRepository $countriesRepository;
|
||||||
*
|
|
||||||
* @var EntityRepository
|
|
||||||
*/
|
|
||||||
protected $countriesRepository;
|
|
||||||
|
|
||||||
/**
|
private TranslatableStringHelper $translatableStringHelper;
|
||||||
*
|
|
||||||
* @var TranslatableStringHelper
|
|
||||||
*/
|
|
||||||
protected $translatableStringHelper;
|
|
||||||
|
|
||||||
/**
|
private TranslatorInterface $translator;
|
||||||
*
|
|
||||||
* @var TranslatorInterface
|
|
||||||
*/
|
|
||||||
protected $translator;
|
|
||||||
|
|
||||||
public function __construct(EntityRepository $countriesRepository,
|
public function __construct(
|
||||||
TranslatableStringHelper $translatableStringHelper,
|
CountryRepository $countriesRepository,
|
||||||
TranslatorInterface $translator)
|
TranslatableStringHelper $translatableStringHelper,
|
||||||
{
|
TranslatorInterface $translator
|
||||||
|
) {
|
||||||
$this->countriesRepository = $countriesRepository;
|
$this->countriesRepository = $countriesRepository;
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
$this->translatableStringHelper = $translatableStringHelper;
|
||||||
$this->translator = $translator;
|
$this->translator = $translator;
|
||||||
|
@ -68,6 +68,11 @@ services:
|
|||||||
resource: '../Controller/'
|
resource: '../Controller/'
|
||||||
tags: ['controller.service_arguments']
|
tags: ['controller.service_arguments']
|
||||||
|
|
||||||
|
Chill\PersonBundle\Export\:
|
||||||
|
autowire: true
|
||||||
|
autoconfigure: true
|
||||||
|
resource: '../Export/'
|
||||||
|
|
||||||
Chill\PersonBundle\Templating\Entity\:
|
Chill\PersonBundle\Templating\Entity\:
|
||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
|
@ -36,43 +36,39 @@ services:
|
|||||||
chill.person.export.filter_birthdate:
|
chill.person.export.filter_birthdate:
|
||||||
class: Chill\PersonBundle\Export\Filter\BirthdateFilter
|
class: Chill\PersonBundle\Export\Filter\BirthdateFilter
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export_filter, alias: person_birthdate_filter }
|
- { name: chill.export_filter, alias: person_birthdate_filter }
|
||||||
|
|
||||||
chill.person.export.filter_nationality:
|
chill.person.export.filter_nationality:
|
||||||
class: Chill\PersonBundle\Export\Filter\NationalityFilter
|
class: Chill\PersonBundle\Export\Filter\NationalityFilter
|
||||||
arguments:
|
autowire: true
|
||||||
- "@chill.main.helper.translatable_string"
|
autoconfigure: true
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export_filter, alias: person_nationality_filter }
|
- { name: chill.export_filter, alias: person_nationality_filter }
|
||||||
|
|
||||||
chill.person.export.aggregator_nationality:
|
chill.person.export.aggregator_nationality:
|
||||||
class: Chill\PersonBundle\Export\Aggregator\NationalityAggregator
|
class: Chill\PersonBundle\Export\Aggregator\NationalityAggregator
|
||||||
arguments:
|
autowire: true
|
||||||
- "@chill.main.countries_repository"
|
autoconfigure: true
|
||||||
- "@chill.main.helper.translatable_string"
|
|
||||||
- "@translator"
|
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export_aggregator, alias: person_nationality_aggregator }
|
- { name: chill.export_aggregator, alias: person_nationality_aggregator }
|
||||||
|
|
||||||
chill.person.export.aggregator_country_of_birth:
|
chill.person.export.aggregator_country_of_birth:
|
||||||
class: Chill\PersonBundle\Export\Aggregator\CountryOfBirthAggregator
|
class: Chill\PersonBundle\Export\Aggregator\CountryOfBirthAggregator
|
||||||
arguments:
|
autowire: true
|
||||||
- "@chill.main.countries_repository"
|
autoconfigure: true
|
||||||
- "@chill.main.helper.translatable_string"
|
|
||||||
- "@translator"
|
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export_aggregator, alias: person_country_of_birth_aggregator }
|
- { name: chill.export_aggregator, alias: person_country_of_birth_aggregator }
|
||||||
|
|
||||||
chill.person.export.aggregator_gender:
|
chill.person.export.aggregator_gender:
|
||||||
class: Chill\PersonBundle\Export\Aggregator\GenderAggregator
|
class: Chill\PersonBundle\Export\Aggregator\GenderAggregator
|
||||||
arguments:
|
autowire: true
|
||||||
- "@translator"
|
autoconfigure: true
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export_aggregator, alias: person_gender_aggregator }
|
- { name: chill.export_aggregator, alias: person_gender_aggregator }
|
||||||
|
|
||||||
chill.person.export.aggregator_age:
|
chill.person.export.aggregator_age:
|
||||||
class: Chill\PersonBundle\Export\Aggregator\AgeAggregator
|
class: Chill\PersonBundle\Export\Aggregator\AgeAggregator
|
||||||
arguments:
|
autowire: true
|
||||||
- "@translator"
|
autoconfigure: true
|
||||||
tags:
|
tags:
|
||||||
- { name: chill.export_aggregator, alias: person_age_aggregator }
|
- { name: chill.export_aggregator, alias: person_age_aggregator }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user