mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 05:44:24 +00:00
add validation to activityreasonaggregator
This commit is contained in:
parent
9bcd7a2c10
commit
7a76868f6a
@ -27,13 +27,16 @@ use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Doctrine\ORM\Query\Expr\Join;
|
||||
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||
*/
|
||||
class ActivityReasonAggregator implements AggregatorInterface
|
||||
class ActivityReasonAggregator implements AggregatorInterface,
|
||||
ExportElementValidatedInterface
|
||||
{
|
||||
/**
|
||||
*
|
||||
@ -150,8 +153,16 @@ class ActivityReasonAggregator implements AggregatorInterface
|
||||
'label' => 'Reason\'s level'
|
||||
));
|
||||
}
|
||||
|
||||
public function validateForm($data, ExecutionContextInterface $context)
|
||||
{
|
||||
if ($data['level'] === null) {
|
||||
$context->buildViolation("The reasons's level should not be empty")
|
||||
->addViolation();
|
||||
}
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
public function getTitle()
|
||||
{
|
||||
return "Aggregate by activity reason";
|
||||
}
|
||||
|
1
Resources/translations/validators.fr.yml
Normal file
1
Resources/translations/validators.fr.yml
Normal file
@ -0,0 +1 @@
|
||||
The reasons's level should not be empty: Le niveau du sujet ne peut pas être vide
|
Loading…
x
Reference in New Issue
Block a user