mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-14 19:59:50 +00:00
fix deprecations: use fqcn
This commit is contained in:
parent
4b57510cc2
commit
657a4f3fa1
@ -145,7 +145,7 @@ class PersonController extends Controller
|
|||||||
->setCenter($defaultCenter);
|
->setCenter($defaultCenter);
|
||||||
|
|
||||||
$form = $this->createForm(
|
$form = $this->createForm(
|
||||||
CreationPersonType::NAME,
|
CreationPersonType::class,
|
||||||
$person,
|
$person,
|
||||||
array(
|
array(
|
||||||
'action' => $this->generateUrl('chill_person_review'),
|
'action' => $this->generateUrl('chill_person_review'),
|
||||||
|
@ -27,10 +27,11 @@ use Chill\MainBundle\Templating\TranslatableStringHelper;
|
|||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Chill\MainBundle\Entity\Country;
|
use Chill\MainBundle\Entity\Country;
|
||||||
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
||||||
|
use Chill\MainBundle\Form\Type\Select2CountryType;
|
||||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||||
*/
|
*/
|
||||||
@ -42,25 +43,25 @@ class NationalityFilter implements FilterInterface,
|
|||||||
* @var TranslatableStringHelper
|
* @var TranslatableStringHelper
|
||||||
*/
|
*/
|
||||||
private $translatableStringHelper;
|
private $translatableStringHelper;
|
||||||
|
|
||||||
public function __construct(TranslatableStringHelper $helper)
|
public function __construct(TranslatableStringHelper $helper)
|
||||||
{
|
{
|
||||||
$this->translatableStringHelper = $helper;
|
$this->translatableStringHelper = $helper;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn()
|
public function applyOn()
|
||||||
{
|
{
|
||||||
return 'person';
|
return 'person';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
{
|
{
|
||||||
$builder->add('nationalities', 'select2_chill_country', array(
|
$builder->add('nationalities', Select2CountryType::class, array(
|
||||||
'placeholder' => 'Choose countries'
|
'placeholder' => 'Choose countries'
|
||||||
));
|
));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function validateForm($data, ExecutionContextInterface $context)
|
public function validateForm($data, ExecutionContextInterface $context)
|
||||||
{
|
{
|
||||||
if ($data['nationalities'] === null) {
|
if ($data['nationalities'] === null) {
|
||||||
@ -68,7 +69,7 @@ class NationalityFilter implements FilterInterface,
|
|||||||
->addViolation();
|
->addViolation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data)
|
||||||
{
|
{
|
||||||
$where = $qb->getDQLPart('where');
|
$where = $qb->getDQLPart('where');
|
||||||
@ -83,27 +84,27 @@ class NationalityFilter implements FilterInterface,
|
|||||||
$qb->add('where', $where);
|
$qb->add('where', $where);
|
||||||
$qb->setParameter('person_nationality', array($data['nationalities']));
|
$qb->setParameter('person_nationality', array($data['nationalities']));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTitle()
|
public function getTitle()
|
||||||
{
|
{
|
||||||
return "Filter by person's nationality";
|
return "Filter by person's nationality";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole()
|
public function addRole()
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function describeAction($data, $format = 'string')
|
public function describeAction($data, $format = 'string')
|
||||||
{
|
{
|
||||||
$countries = $data['nationalities'];
|
$countries = $data['nationalities'];
|
||||||
|
|
||||||
$names = array_map(function(Country $c) {
|
$names = array_map(function(Country $c) {
|
||||||
return $this->translatableStringHelper->localize($c->getName());
|
return $this->translatableStringHelper->localize($c->getName());
|
||||||
}, array($countries));
|
}, array($countries));
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
"Filtered by nationality : %nationalities%",
|
"Filtered by nationality : %nationalities%",
|
||||||
array('%nationalities%' => implode(", ", $names))
|
array('%nationalities%' => implode(", ", $names))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user