Merge branch 'master' into accompanying_period_voter

This commit is contained in:
Julien Fastré 2023-07-05 22:39:22 +02:00
commit e40b1b9853
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
2 changed files with 6 additions and 3 deletions

View File

@ -16,6 +16,8 @@ use Chill\EventBundle\Entity\Event;
use Chill\EventBundle\Entity\Participation; use Chill\EventBundle\Entity\Participation;
use Chill\EventBundle\Form\ParticipationType; use Chill\EventBundle\Form\ParticipationType;
use Chill\EventBundle\Security\Authorization\ParticipationVoter; use Chill\EventBundle\Security\Authorization\ParticipationVoter;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ReadableCollection;
use LogicException; use LogicException;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use RuntimeException; use RuntimeException;
@ -509,7 +511,7 @@ class ParticipationController extends AbstractController
/** /**
* @return \Symfony\Component\Form\FormInterface * @return \Symfony\Component\Form\FormInterface
*/ */
protected function createEditFormMultiple(ArrayIterator $participations, Event $event) protected function createEditFormMultiple(Collection $participations, Event $event)
{ {
$form = $this->createForm( $form = $this->createForm(
\Symfony\Component\Form\Extension\Core\Type\FormType::class, \Symfony\Component\Form\Extension\Core\Type\FormType::class,
@ -638,6 +640,7 @@ class ParticipationController extends AbstractController
$ignoredParticipations = $newParticipations = []; $ignoredParticipations = $newParticipations = [];
foreach ($participations as $participation) { foreach ($participations as $participation) {
/** @var Participation $participation */
// check for authorization // check for authorization
$this->denyAccessUnlessGranted( $this->denyAccessUnlessGranted(
ParticipationVoter::CREATE, ParticipationVoter::CREATE,

View File

@ -160,11 +160,11 @@ class Event implements HasCenterInterface, HasScopeInterface
} }
/** /**
* @return ArrayIterator|Collection|Traversable * @return Collection<Participation>
*/ */
public function getParticipations() public function getParticipations()
{ {
return $this->getParticipationsOrdered(); return new ArrayCollection(iterator_to_array($this->getParticipationsOrdered()));
} }
/** /**