[wip] add different steps to exports

This commit is contained in:
2016-01-11 21:46:41 +01:00
parent 2711fcee6d
commit d81b2e1037
3 changed files with 108 additions and 2 deletions

View File

@@ -22,6 +22,7 @@ namespace Chill\PersonBundle\Export\Export;
use Chill\MainBundle\Export\ExportInterface;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
use Doctrine\ORM\Query;
/**
*
@@ -63,6 +64,33 @@ class CountPerson implements ExportInterface
return $qb;
}
public function getResult($qb, $data)
{
return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR);
}
public function getQueryKeys($data)
{
return array('export_result');
}
public function getLabels($key, array $values, $data)
{
if ($key !== 'export_result') {
throw new \LogicException("the key $key is not used by this export");
}
$labels = array_combine($values, $values);
$labels['_header'] = 'Number of people';
return $labels;
}
public function getAllowedFormattersTypes()
{
return array('tabular');
}
public function buildForm(FormBuilderInterface $builder) {
throw new \LogicException('This export does not require a form');
}