[export] add a first export and first filters

- nationality aggregator (work in progress: we have to set the feature
  'group by continent')
- gender filter
- nationality filter
- gender filter
This commit is contained in:
2016-01-02 16:46:11 +01:00
parent 4e4f45e2bc
commit 2711fcee6d
5 changed files with 609 additions and 0 deletions

View File

@@ -0,0 +1,79 @@
<?php
/*
* Copyright (C) 2015 Champs-Libres <info@champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Chill\PersonBundle\Export\Export;
use Chill\MainBundle\Export\ExportInterface;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
/**
*
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
*/
class CountPerson implements ExportInterface
{
/**
*
*/
public function getType()
{
return 'person';
}
public function getDescription()
{
return "Count persons by various parameters.";
}
public function getTitle()
{
return "Count persons";
}
/**
* Initiate the query
*
* @param QueryBuilder $qb
* @return QueryBuilder
*/
public function initiateQuery(QueryBuilder $qb, array $requiredModifiers)
{
$qb->select('COUNT(person.id) AS export_result')
->from('ChillPersonBundle:Person', 'person')
;
return $qb;
}
public function buildForm(FormBuilderInterface $builder) {
throw new \LogicException('This export does not require a form');
}
public function hasForm(){
return false;
}
public function supportsModifiers()
{
return array('person');
}
}