[TYPO3-mvc] Import Script Problems
Nikolas Hagelstein
lists at shr-now.de
Thu Jun 17 10:10:29 CEST 2010
Hi,
> Thanks for your input. Can you tell me how take care of updating
> objects
> properly and especially how you create new objects? Do you simply
> create
> a new instance and fill it with the according setters, or do you use
> dataMapper->map for this? I fear mapping might not work as I don't have
> a UID yet - so I suppose I have to do it by calling the setters? Same I
> think for updating.
I simply create a new instance and populate the object using setters.
For updating I either create an additional unique key (md5 or similar) or
use the key provided by the foreign system. (Depends on the data source).
One thing:
Keeping track of removed/disable objects in regular full imports is a bit
tricky (I.e. Rows have been removed from the csv file by the foreign
system).
I do it by flagging all objects as "hidden" prior to the import and setting
the hidden filed to false within the import.
Don't use the deleted field since you will get in trouble due to the
"special handling"(RemoveAll <-> set deleted=true) of this field.
If you decide to use the hidden field make sure you use your own find
function for the import having:
"$query->getQuerySettings()->setRespectEnableFields(FALSE);"
If you need to create relations during the import, it's a good idea to make
use of some first level caching within the import domain service. In order
to reduced the database load and increase overall performance.
Sorry for getting a bit too much into detail but i thought that "deleted"
thing was worth mentioning (took me a bit to realized what is going on).
> Reason why I'm asking is, that I intended to make the CSV files
> mappable
> to the object properties and thus would have to dynamically build the
> setter-names (which is of course not a problem, but a bit more work).
Interessting...not sure if i fully got what you are planning to do, could
you provide some additional information?.
Cheers,
Nikolas
More information about the TYPO3-project-typo3v4mvc
mailing list