[TYPO3-dev] setUid on new model instance

Richard Davies richard at ocular.co.nz
Thu Mar 3 21:50:25 CET 2016


Hey Thomas,

I would recommend not doing this. If you create an object that is related
to other extbase objects this could break those relations.
That said, my workaround idea would be:

   - Create object
   - Add to repository
   - Persist
   - call getUid()
   - Use a $GLOBALS['TYPO3_DB'] query set uid = x where uid = y
   - If you need to use the object to create relations with the correct
   uid, load the updated object from the repository


Richard

On 4 March 2016 at 03:29, Thomas Mammitzsch <thomas at visualworx.de> wrote:

> Hi list,
>
> is it possible (i know its not recommended) to set the uid of a newly
> created model instance somehow? I tried it via a setUid-Setter method in
> the model, but the instance doesn't get persisted it seems, even after
> persistAll call.
> Btw. its extbase 6.2
>
> regards, Thomas
> _______________________________________________
> TYPO3-dev mailing list
> TYPO3-dev at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-dev
>



More information about the TYPO3-dev mailing list