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