/** * @test */ public function removeParticipationFromObjectStorageHoldingParticipations() { $participation = new Tx_Nbowishlist_Domain_Model_Participation(); $localObjectStorage = new Tx_Extbase_Persistence_ObjectStorage(); $localObjectStorage->attach($participation); $localObjectStorage->detach($participation); $this->fixture->addParticipation($participation); $this->fixture->removeParticipation($participation); $this->assertEquals($localObjectStorage, $this->fixture->getParticipations()); }
/** * action create * * @param $newParticipation * @param $newPerson * @param $wish * @return void * @dontverifyrequesthash */ public function createAction(Tx_Nbowishlist_Domain_Model_Participation $newParticipation, Tx_Nbowishlist_Domain_Model_Person $newPerson, Tx_Nbowishlist_Domain_Model_Wish $wish) { $this->participationRepository->add($newParticipation); $newParticipation->setShare($newParticipation->getShare()); if (!$newPerson->getUid()) { $this->personRepository->add($newPerson); } else { $this->personRepository->update($newPerson); } //Enforce persistence $persistenceManager = t3lib_div::makeInstance('Tx_Extbase_Persistence_Manager'); $persistenceManager->persistAll(); $newPerson->addParticipation($newParticipation); $wish->addParticipation($newParticipation); Tx_Nboevents_Utility_Cookies::setCookieValue('Participation' . $wish->getUid(), $newParticipation->getUid()); Tx_Nboevents_Utility_Cookies::setCookieValue('Person', $newPerson->getUid()); $this->flashMessageContainer->add('<h3>Danke ' . $newPerson->getFirstname() . ' ' . $newPerson->getLastname() . '!</h3>Du beteiligst Dich mit ' . $newParticipation->getShare() . ' CHF an diesem Geschenk.'); $this->redirect('show', 'Wish', NULL, array('wish' => $wish->getUid())); }