adapting classes to new interfaces

This commit is contained in:
2016-02-01 00:01:21 +01:00
parent 9f7fe05991
commit 7619b41cd4
6 changed files with 144 additions and 8 deletions

View File

@@ -23,6 +23,7 @@ use Symfony\Component\Form\FormBuilderInterface;
use Doctrine\ORM\QueryBuilder;
use Chill\MainBundle\Export\AggregatorInterface;
use Symfony\Component\Security\Core\Role\Role;
use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
/**
*
@@ -86,9 +87,28 @@ class ReasonAggregator implements AggregatorInterface
return "Aggregate by activity reason";
}
public function requiredRole()
public function addRole()
{
return new Role('dummy');
return new Role(ActivityVoter::SEE);
}
public function getLabels($key, array $values, $data)
{
return array_combine($values, $values);
}
public function getQueryKeys($data)
{
// add select element
if ($data['level'] === 'reason') {
return array('activity_reason_id');
} elseif ($data['level'] === 'category') {
return array ('activity_category_id');
} else {
throw new \RuntimeException('the data provided are not recognised');
}
}
}