[export] fix data type from form: either collection or array

This commit is contained in:
2023-11-05 23:08:13 +01:00
parent b2aa465b03
commit 6fd80f9f2e
17 changed files with 51 additions and 12 deletions

View File

@@ -16,6 +16,7 @@ use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
use Chill\PersonBundle\Export\Declarations;
use Chill\PersonBundle\Form\Type\PickSocialIssueType;
use Chill\PersonBundle\Templating\Entity\SocialIssueRender;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
@@ -50,7 +51,9 @@ class SocialIssueFilter implements FilterInterface
$qb->andWhere($clause)
->setParameter(
'socialissues',
SocialIssue::getDescendantsWithThisForIssues($data['accepted_socialissues']->toArray())
SocialIssue::getDescendantsWithThisForIssues(
$data['accepted_socialissues'] instanceof Collection ? $data['accepted_socialissues']->toArray() : $data['accepted_socialissues']
)
);
}

View File

@@ -17,6 +17,7 @@ use Chill\MainBundle\Export\FilterInterface;
use Chill\MainBundle\Repository\UserJobRepositoryInterface;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Chill\PersonBundle\Export\Declarations;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Query\Expr\Join;
use Doctrine\ORM\QueryBuilder;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
@@ -105,7 +106,7 @@ class UserJobFilter implements FilterInterface
', ',
array_map(
fn (UserJob $job) => $this->translatableStringHelper->localize($job->getLabel()),
$data['jobs']->toArray()
$data['jobs'] instanceof Collection ? $data['jobs']->toArray() : $data['jobs']
)
),
],

View File

@@ -17,6 +17,7 @@ use Chill\MainBundle\Export\FilterInterface;
use Chill\MainBundle\Repository\ScopeRepositoryInterface;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Chill\PersonBundle\Export\Declarations;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Query\Expr\Join;
use Doctrine\ORM\QueryBuilder;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
@@ -104,7 +105,7 @@ class UserScopeFilter implements FilterInterface
', ',
array_map(
fn (Scope $s) => $this->translatableStringHelper->localize($s->getName()),
$data['scopes']->toArray()
$data['scopes'] instanceof Collection ? $data['scopes']->toArray() : $data['scopes']
)
),
],