[TYPO3-mvc] catch the uid within the create Action of a controller

Christine Gerpheide cgerpheide at gmail.com
Fri May 21 17:03:08 CEST 2010


Hi Mario,


>
>> So the goal is to have the UID of the actual created record within the
>> CREATE action
>
>

To access the uid of a newly created object inside the same action, you have
to call persistAll() first:

  $this->objectRepository->add($newObject);

  $persistenceManager =
t3lib_div::makeInstance('Tx_Extbase_Persistence_Manager');
  $persistenceManager->persistAll();
//uid now available
  $this->redirect('new','Page',null,array('object'=>$newObject));

(In our case we needed the UID so we could do a redirect with it)

Hope that helps,
Christine

>
>
>


More information about the TYPO3-project-typo3v4mvc mailing list