[TYPO3-mvc] repository add-method does not write to db

Christian Hansen christian at bildungsweb.net
Tue Feb 21 09:26:12 CET 2012


There was something wrong with the repository, after 6 hours i found 
it... Thanx for your help everyone

Am 20.02.2012 23:19, schrieb Claus Due:
> Hmm, sorry - was a little too quick. There could be other circumstances.
>
> You use AJAX - are you sure that the PersistenceManager is allowed to shut down (i.e. do you use exit() anywhere or call the method manually etc)? It may help if you add:
>
> $this->objectManager->get('Tx_Extbase_Persistence_Manager')->persistAll();
>
> in your createKopieAction after $this->anbieterRepository->add($anbieterKopie).
>
> --
> Cheers,
> Claus
> http://fedext.net
>
> On Feb 20, 2012, at 9:16 PM, Christian Hansen wrote:
>
>> hi there,
>>
>> i have a problem with some strange behaviour of the repository add-method, in same controller, two actions, one time it works, the other time no exception is shown, no failed query and nothing is written to database.... any ideas around?
>>
>>
>> This Works:
>>
>> ________________________________________________________________________
>>
>> /**
>> * @param Tx_BwebBe_Domain_Model_Anbieter $anbieter
>> * @return void
>> */
>> public function createKopieAction(Tx_BwebBe_Domain_Model_Anbieter $anbieter) {
>> 	$anbieterKopie		= t3lib_div::makeInstance(Tx_BwebBe_Domain_Model_Anbieter);
>> 	$anbieterOriginal	= $this->anbieterRepository->findByUid($this->getAnbieterID());
>> 	$propertyMapper		= t3lib_div::makeInstance(Tx_Extbase_Property_Mapper);
>>
>> 	// Anbieterdaten an Kopie übergeben
>> 	$propertyMapper->map($this->mapping, $anbieter, $anbieterKopie);
>>
>> 	// Kopie schreiben und Kopie an Original hängen
>> 	$this->anbieterRepository->add($anbieterKopie);
>> 	$anbieterOriginal->setLetzteKopie($anbieterKopie);
>>
>> 	$this->flashMessageContainer->add(Tx_Extbase_Utility_Localization::translate('tx_bwebbe.aenderungenGespeichert', 'bweb_be'));
>>
>> 	// Antwort als JSON, wenn es per AJAX aufgerufen wurde.
>> 	if ($this->ajax === TRUE) {
>> 		return json_encode(array('status' =>  'ok'));
>> 	}
>> }
>>
>> ______________________________________________________________________________
>>
>>
>> doesn't work:
>>
>> _____________________________________________________________________________
>>
>> /**
>> * @param Tx_BwebBe_Domain_Model_Anbieter
>> * @return void
>> */
>> public function createAction(Tx_BwebBe_Domain_Model_Anbieter $newAnbieter) {
>>
>> 	// Neuer Anbieter bekommt Status in Prüfung
>> 	$newAnbieter->setInPruefung(TRUE);
>>
>> 	$this->anbieterRepository->add($newAnbieter);
>>
>> 	$this->flashMessageContainer->add(Tx_Extbase_Utility_Localization::translate('tx_bwebbe.anbieter.' . $this->getBereich() . '.anlegenOK', 'bweb_be'));
>> 	$this->redirect('show', 'Administrator');
>> }
>>
>> _______________________________________________________________________________
>>
>> No Exception, no sql-error, nothing written do db.
>>
>> i'm out of ideas...
>>
>>
>>
>>
>>
>> --
>> Bildungsweb Media GmbH
>> Christian Hansen | Webdevelopment
>> TEL 040 - 609400688
>> http://www.bildungsweb.net | christian at bildungsweb.net
>> _______________________________________________
>> TYPO3-project-typo3v4mvc mailing list
>> TYPO3-project-typo3v4mvc at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc

-- 
Bildungsweb Media GmbH
Christian Hansen | Webdevelopment
TEL 040 - 609400688
http://www.bildungsweb.net | christian at bildungsweb.net


More information about the TYPO3-project-typo3v4mvc mailing list