mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 10:33:49 +00:00
add validation on aggregators and filters
This commit is contained in:
@@ -28,13 +28,16 @@ use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Chill\MainBundle\Util\CountriesInfo;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||
*/
|
||||
class NationalityAggregator implements AggregatorInterface
|
||||
class NationalityAggregator implements AggregatorInterface,
|
||||
ExportElementValidatedInterface
|
||||
{
|
||||
/**
|
||||
*
|
||||
@@ -82,6 +85,14 @@ class NationalityAggregator implements AggregatorInterface
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
public function validateForm($data, ExecutionContextInterface $context)
|
||||
{
|
||||
if ($data['group_by_level'] === null) {
|
||||
$context->buildViolation("You should select an option")
|
||||
->addViolation();
|
||||
}
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
|
Reference in New Issue
Block a user