mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 18:43:49 +00:00
add validation on aggregators and filters
This commit is contained in:
@@ -22,13 +22,16 @@ namespace Chill\PersonBundle\Export\Aggregator;
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
||||
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||
*/
|
||||
class AgeAggregator implements AggregatorInterface
|
||||
class AgeAggregator implements AggregatorInterface,
|
||||
ExportElementValidatedInterface
|
||||
{
|
||||
|
||||
public function addRole()
|
||||
@@ -58,6 +61,14 @@ class AgeAggregator implements AggregatorInterface
|
||||
'format' => 'dd-MM-yyyy'
|
||||
));
|
||||
}
|
||||
|
||||
public function validateForm($data, ExecutionContextInterface $context)
|
||||
{
|
||||
if ($data['date_age_calculation'] === null) {
|
||||
$context->buildViolation("The date should not be empty")
|
||||
->addViolation();
|
||||
}
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
|
Reference in New Issue
Block a user