[TYPO3-mvc] [Extbase] Get tstamp / crdate right after persist

Claus Fassing claus at fassing.eu
Mon Jun 3 12:16:19 CEST 2013


Extbase Version : 1.3.4
TYPO3 Version : 4.5.27

Hello,

I try to get the tstamp / crdate from an object right after add to 
repository and persist.

e.g. I would like to get tstamp / crdate from $newData after persist.
public function createAction(Tx_EXT_Domain_Model_Data $newData) {
     $this->persistenceManager = 
$this->objectManager->get('Tx_Extbase_Persistence_Manager');

     // Existing database entry
     $data = $this->dataRepository->findOneByUid(1);
     $foo = $data->getTstamp(); // Or getCrdate() are working

     // Persist data immediately
     $this->dataRepository->add($newData);
     $this->persistenceManager->persistAll();
     // At this moment I can see the record in database with tstamp and 
crdate.
     $bar = $newData->getTstamp(); // Or getCrdate() return NULL
}

tstamp and crdate are defined as properties with getter and setter 
method in the model.


TCA definition :
[...]
'tstamp' => Array(
     'exclude' => 0,
     'label' => 'Change date',
     'config' => Array(
	'type' => 'none',
	'format' => 'date',
	'eval' => 'date',
),
'crdate' => Array(
     'exclude' => 0,
     'label' => 'Creation date',
     'config' => Array(
	'type' => 'none',
	'format' => 'date',
	'eval' => 'date',
     )
),
[...]

It is possible that tstamp and crdate not reachable after add / persist 
at all ?
Or what kind of methods I am left to reach the tstamp / crdate in this 
situation ?

Regards Claus


More information about the TYPO3-project-typo3v4mvc mailing list