[TYPO3-mvc] Get last id
Franz Koch
typo3.RemoveForMessage at elements-net.de
Mon Jan 17 15:31:06 CET 2011
Hi,
> Ok I get it. But when I add in this way a new record to database it is
> inserted with out pid :/
>
> I do something like that
>
> $tempRecord = t3lib_div::makeInstance('Tx_MyExt_Domain_Model_Record');
> $tempRecord->setRUid($val['uid']);
> $tempRecord->addPortal($portalRepository->findByUid(13));
> $tempRecord->setTableName($table);
> $this->add($tempRecord);
> $persistenceManager->persistAll();
>
> It works great only the pid isn`t set
what are you trying to achieve? Is it some sort of import module inside
the repository class? Not sure if it belongs there - I'd rather move it
to a import controller. Also you don't have to persist manually if you
don't need to work with the UID of the object directly - you can also
assign new objects directly to other objects and those get updated
automatically when persisted (you still have to add the new object to
the repository though).
To your PID issue - have you defined a "storagePid" (globally for your
extension) or probably better "newRecordStoragePid" (explicitly for your
model) via TS?
--
kind regards,
Franz Koch
More information about the TYPO3-project-typo3v4mvc
mailing list