minor changes

This commit is contained in:
Julie Lenaerts 2022-08-30 13:14:40 +02:00
parent cf642d2783
commit 72b5fcf998
3 changed files with 13 additions and 5 deletions

View File

@ -60,6 +60,7 @@ class CancelReasonAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data) public function alterQuery(QueryBuilder $qb, $data)
{ {
// TODO: still needs to take into account appointments without a cancel reason somehow
$qb->join('cal.cancelReason', 'cr'); $qb->join('cal.cancelReason', 'cr');
$qb->addSelect('IDENTITY(cal.cancelReason) as cancel_reason_aggregator'); $qb->addSelect('IDENTITY(cal.cancelReason) as cancel_reason_aggregator');

View File

@ -12,6 +12,7 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators; namespace Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators;
use Chill\MainBundle\Export\AggregatorInterface; use Chill\MainBundle\Export\AggregatorInterface;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Chill\PersonBundle\Export\Declarations; use Chill\PersonBundle\Export\Declarations;
use Chill\PersonBundle\Repository\SocialWork\ResultRepository; use Chill\PersonBundle\Repository\SocialWork\ResultRepository;
use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\QueryBuilder;
@ -21,9 +22,12 @@ final class ResultAggregator implements AggregatorInterface
{ {
private ResultRepository $resultRepository; private ResultRepository $resultRepository;
public function __construct(ResultRepository $resultRepository) private TranslatableStringHelper $translatableStringHelper;
public function __construct(ResultRepository $resultRepository, TranslatableStringHelper $translatableStringHelper)
{ {
$this->resultRepository = $resultRepository; $this->resultRepository = $resultRepository;
$this->translatableStringHelper = $translatableStringHelper;
} }
public function addRole() public function addRole()
@ -34,7 +38,9 @@ final class ResultAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data) public function alterQuery(QueryBuilder $qb, $data)
{ {
$qb->join('acpw.results', 'res'); $qb->join('acpw.results', 'res');
$qb->addSelect('res.id as result_aggregator'); $qb->join('acpw.goals', 'g');
$qb->join('g.results', 'gres');
$qb->addSelect('res.id, IDENTITY(g.results) as result_aggregator');
$groupBy = $qb->getDQLPart('groupBy'); $groupBy = $qb->getDQLPart('groupBy');

View File

@ -11,6 +11,7 @@ use Doctrine\ORM\Query\Expr\Andx;
use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\QueryBuilder;
use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Chill\PersonBundle\Entity\SocialWork\SocialAction; use Chill\PersonBundle\Entity\SocialWork\SocialAction;
use Chill\PersonBundle\Templating\Entity\SocialActionRender; use Chill\PersonBundle\Templating\Entity\SocialActionRender;
@ -68,21 +69,21 @@ class SocialWorkTypeFilter implements FilterInterface
]); ]);
}; };
$builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($refreshGoals) { $builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) use ($refreshGoals) {
$data = $event->getData(); $data = $event->getData();
dump($data); dump($data);
$refreshGoals($event->getForm(), $data); $refreshGoals($event->getForm(), $data);
}); });
$builder->get('actionType')->addEventListener( /* $builder->get('actionType')->addEventListener(
FormEvents::POST_SUBMIT, FormEvents::POST_SUBMIT,
function (FormEvent $event) use ($refreshGoals) { function (FormEvent $event) use ($refreshGoals) {
$actionType = $event->getForm()->getData(); $actionType = $event->getForm()->getData();
dump($actionType); dump($actionType);
$refreshGoals($event->getForm()->getParent(), $actionType); $refreshGoals($event->getForm()->getParent(), $actionType);
} }
); );*/
} }
public function getTitle(): string public function getTitle(): string