/** * Sets panel state to beginning (currentState => empty) and removes all votes from all votingOptions from all votings * * @param Panel $panel * @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException */ protected function resetPanel(Panel $panel) { $panel->setCurrentState(''); foreach ($panel->getVotings() as $voting) { /** @var $voting \Visol\EasyvoteEducation\Domain\Model\Voting */ foreach ($voting->getVotingOptions() as $votingOption) { /** @var $votingOption \Visol\EasyvoteEducation\Domain\Model\VotingOption */ $votingOption->getVotes()->removeAll($votingOption->getVotes()); $this->votingOptionRepository->update($votingOption); } } $this->persistenceManager->persistAll(); }