[TYPO3-mvc] Persistene problem with new objects from form inputs

Michael Knoll mimi at kaktusteam.de
Tue Dec 22 15:44:32 CET 2009


Hi there,

I have a problem with objects being generated from form - inputs. Regard 
the following function:

	/**
	 * Adds a new album to repository
	 *
	 * @param Tx_Yag_Domain_Model_Album $newAlbum  New album to add
	 * @return string  The rendered create action
	 */
	public function createAction(Tx_Yag_Domain_Model_Album 			
           $newAlbum, Tx_Yag_Domain_Model_Gallery $gallery = NULL) {
		$this->albumRepository->add($newAlbum);
		if ($gallery != NULL) {
			$gallery->addAlbum($newAlbum);
		}
		$this->flashMessages->add('Your new album was
                   created.');
		$this->redirect('index','Album', NULL, array('album' =>
                   $newAlbum, 'gallery' => $gallery));
	}


In the last line, I try to redirect with "newAlbum" as argument. As this 
object does not seem to be saved at that moment, uri-builder fails to 
add its ID to the URI and I cannot use its contents.

Is there any way to tell the repository to "update" the objects and 
tables immediately?

Remind, that the $newAlbum object has just been created from a user 
input from an form!

Thanks for your help!

Greetings

Michael


More information about the TYPO3-project-typo3v4mvc mailing list