mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix deprecations: systematic use of fqcn in getParent functions
This commit is contained in:
parent
2474bb3e5a
commit
7e36eee27a
@ -22,6 +22,7 @@ namespace Chill\MainBundle\Form\Type;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Chill\MainBundle\Entity\PostalCode;
|
||||
|
||||
@ -38,18 +39,18 @@ class PostalCodeType extends AbstractType
|
||||
* @var TranslatableStringHelper
|
||||
*/
|
||||
protected $translatableStringHelper;
|
||||
|
||||
|
||||
public function __construct(TranslatableStringHelper $helper)
|
||||
{
|
||||
$this->translatableStringHelper = $helper;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function getParent()
|
||||
{
|
||||
return \Symfony\Bridge\Doctrine\Form\Type\EntityType::class;
|
||||
return EntityType::class;
|
||||
}
|
||||
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
// create a local copy for usage in Closure
|
||||
|
@ -22,16 +22,17 @@ use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\OptionsResolver\Options;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Chill\MainBundle\Entity\Scope;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
|
||||
/**
|
||||
* Allow to pick amongst available scope for the current
|
||||
* user.
|
||||
*
|
||||
* options :
|
||||
*
|
||||
* user.
|
||||
*
|
||||
* options :
|
||||
*
|
||||
* - `center`: the center of the entity
|
||||
* - `role` : the role of the user
|
||||
*
|
||||
@ -44,28 +45,28 @@ class ScopePickerType extends AbstractType
|
||||
* @var AuthorizationHelper
|
||||
*/
|
||||
protected $authorizationHelper;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @var TokenStorageInterface
|
||||
*/
|
||||
protected $tokenStorage;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @var EntityRepository
|
||||
*/
|
||||
protected $scopeRepository;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @var TranslatableStringHelper
|
||||
*/
|
||||
protected $translatableStringHelper;
|
||||
|
||||
|
||||
public function __construct(
|
||||
AuthorizationHelper $authorizationHelper,
|
||||
TokenStorageInterface $tokenStorage,
|
||||
AuthorizationHelper $authorizationHelper,
|
||||
TokenStorageInterface $tokenStorage,
|
||||
EntityRepository $scopeRepository,
|
||||
TranslatableStringHelper $translatableStringHelper
|
||||
) {
|
||||
@ -75,7 +76,7 @@ class ScopePickerType extends AbstractType
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver
|
||||
@ -86,7 +87,7 @@ class ScopePickerType extends AbstractType
|
||||
->setRequired('role')
|
||||
->setAllowedTypes('role', ['string', \Symfony\Component\Security\Core\Role\Role::class ])
|
||||
;
|
||||
|
||||
|
||||
$resolver
|
||||
->setDefault('class', Scope::class)
|
||||
->setDefault('placeholder', 'Choose the circle')
|
||||
@ -111,14 +112,14 @@ class ScopePickerType extends AbstractType
|
||||
->andWhere(':user MEMBER OF gc.users')
|
||||
->setParameter('user', $this->tokenStorage->getToken()->getUser())
|
||||
;
|
||||
|
||||
|
||||
return $qb;
|
||||
})
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
public function getParent()
|
||||
{
|
||||
return \Symfony\Bridge\Doctrine\Form\Type\EntityType::class;
|
||||
return EntityType::class;
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ namespace Chill\MainBundle\Form\Type;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
|
||||
/**
|
||||
* Extends choice to allow adding select2 library on widget
|
||||
@ -37,7 +38,7 @@ class Select2EntityType extends AbstractType
|
||||
|
||||
public function getParent()
|
||||
{
|
||||
return 'entity';
|
||||
return EntityType::class;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
|
@ -23,14 +23,15 @@ use Doctrine\ORM\EntityRepository;
|
||||
use Symfony\Component\OptionsResolver\Options;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
|
||||
|
||||
/**
|
||||
* Pick a user available for the given role and center.
|
||||
*
|
||||
*
|
||||
* Options :
|
||||
*
|
||||
*
|
||||
* - `role` : the role the user can reach
|
||||
* - `center`: the center a user can reach
|
||||
*
|
||||
@ -43,22 +44,22 @@ class UserPickerType extends AbstractType
|
||||
* @var AuthorizationHelper
|
||||
*/
|
||||
protected $authorizationHelper;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @var TokenStorageInterface
|
||||
*/
|
||||
protected $tokenStorage;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @var EntityRepository
|
||||
*/
|
||||
protected $userRepository;
|
||||
|
||||
|
||||
public function __construct(
|
||||
AuthorizationHelper $authorizationHelper,
|
||||
TokenStorageInterface $tokenStorage,
|
||||
AuthorizationHelper $authorizationHelper,
|
||||
TokenStorageInterface $tokenStorage,
|
||||
EntityRepository $userRepository
|
||||
) {
|
||||
$this->authorizationHelper = $authorizationHelper;
|
||||
@ -66,7 +67,7 @@ class UserPickerType extends AbstractType
|
||||
$this->userRepository = $userRepository;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver
|
||||
@ -77,7 +78,7 @@ class UserPickerType extends AbstractType
|
||||
->setRequired('role')
|
||||
->setAllowedTypes('role', ['string', \Symfony\Component\Security\Core\Role\Role::class ])
|
||||
;
|
||||
|
||||
|
||||
$resolver
|
||||
->setDefault('class', User::class)
|
||||
->setDefault('empty_data', $this->tokenStorage->getToken()->getUser())
|
||||
@ -101,14 +102,14 @@ class UserPickerType extends AbstractType
|
||||
->andWhere('u.enabled = :enabled')
|
||||
->setParameter('enabled', true)
|
||||
;
|
||||
|
||||
|
||||
return $qb;
|
||||
})
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
public function getParent()
|
||||
{
|
||||
return \Symfony\Bridge\Doctrine\Form\Type\EntityType::class;
|
||||
return EntityType::class;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user