Commit 657a4f3f authored by Julien Minet's avatar Julien Minet

fix deprecations: use fqcn

parent 4b57510c
Pipeline #46787 failed with stages
in 3 minutes and 11 seconds
......@@ -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))
);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment