[TYPO3-mvc] Could not serialize Domain Object
Ronny H.
rh at level-pro.de
Thu Nov 12 11:51:27 CET 2015
Hi,
in addition you can use a session to transfer your non persistent object. So you can use redirect with a specific target page id. For example:
/**
* redirect to a specific view
*
* @param \Vendor\Example\Domain\Model\Form $form
* @return void
*/
public function redirectAction(\Vendor\Example\Domain\Model\Form $form) {
// store form data in session
$GLOBALS['TSFE']->fe_user->setKey('ses', 'form', serialize($form));
$GLOBALS['TSFE']->fe_user->storeSessionData();
// redirect to list view
$this->redirect('list', null, null, null, $this->settings['targetPageId']);
}
And then you can just read the session on the specific page
/**
* list view
*
* @param \Vendor\Example\Domain\Model\Form $form
* @return void
*/
public function listAction(\Vendor\Example\Domain\Model\Form $form = null) {
// check if session exists and get data from session
if ($GLOBALS['TSFE']->fe_user->getKey('ses', 'form') && $form === null) {
$form = unserialize($GLOBALS['TSFE']->fe_user->getKey('ses', 'form'));
}
DebugUtility::debug($form);
/// do something
}
More information about the TYPO3-project-typo3v4mvc
mailing list