[TYPO3-dev] extbase: replace an object by another
Alex Bigott
a.bigott at pixel-ink.de
Mon Aug 25 09:22:26 CEST 2014
Hello Anupam,
that's the way I ended up doing it - by hand.
but i am having rather large models and they get input over a XML file.
So i get my model from there already.
It would be a very nice feature if now i could just swap my new against
my old model with one "replace" command but still have all relations
from the old model.
Maybe a wish for a later version of extbase :)
Thanks
Alex
Anupam Chatterjee schrieb:
> On 8/21/2014 6:04 PM, Alex Bigott wrote:
>> Hi,
>>
>> in extbase i would like to replace an object with a new one.
>> The repository has the old and deprecated method "replace" which does
>> exactely nothing.
>>
>> So what is the best way to update an object?
>>
>> I don't see how i could use the "update" method, since i am not able to
>> set the uid of my unpersistet new object.
>>
>> Any tips or do i have to do it manually for each attribute in the
>> object?
>>
>> Thanks
>>
>> Alex
>
> Hi Alex,
>
> One of the simplest ways to achieve what you seem to need here would
> be as follows:
>
> - Get the model object corresponding to the record you wish to edit.
>
> - Call the setter corresponding to the values you wish to replace with
> reference to the model object you have received. You do not need to
> call all setters, only the ones you need.
>
> - use update with the model object.
>
> That should be all!
>
> Best regards,
> Anupam Chatterjee
>
> --
> TYPO3 .... inspiring people to share!
>
> TYPO3 Consultant @ Vrisini Infotech Pvt. Ltd.
> _______________________________________________
> TYPO3-dev mailing list
> TYPO3-dev at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-dev
--
Mit freundlichen Grüßen
Alex Bigott
pixelink_200_ohne_claim
Pixel Ink
Adi-Maislinger-Str. 7
81373 München
Fest: +49 89 4520689-12
Fax: +49 89 4520689-10
web: www.pixel-ink.de <http://www.pixel-ink.de/>
E-Mail:a.bigott at pixel-ink.de <mailto:a.bigott at pixel-ink.de>
<https://www.facebook.com/pixelink.muc>
More information about the TYPO3-dev
mailing list