FDG
Mass create resources by dispatching jobs
Hi,
I have a resource where data in a textarea can be submitted
each line should be a new entry.
I'm using the handleRecordCreation to loop through the lines and then dispatch them to a job in chunks (sometimes the entry can be 1million + lines)
Currently it's all working fine, but I had to work around the following in the handleRecordCreation function:
The function needs to return a model, only way I could get it to work is return a new instance of a model with
return new Model();
now I noticed this conflicts with some code in the job since the handleRecordCreation is being overwritten to return a new instance of Model everytime it's called. I solved this by manually retrieving the model each time it is created in the jobs loop.
Is there a way I can fix this with that I don't know of yet or should I just stick to returning new Model();
5 replies