I’m not sure the best way to do that. Have you tried simply $tblfiletrx->saveMany($dataperiode->toArray())?
If that doesn’t work, I think the problem with your current code is that $dataperiode->toArray() will be returning an array of entities, which I don’t believe newEntitites or patchEntities will like; they expect their data as arrays of arrays. (Side note, if you pass data to newEntities, you don’t need to also patch them.) You might need to create the new entities in a loop over $dataperiode, and then calling toArray on each entity.
Alternately, consider changing the structure, so that you always leave all the records in the one table, and just exclude previous periods from queries where you are loading them.
Thank brother, the record on contain its dynamically update, so if i exclude without clone, the record will take new modfied, and the informatin will change, i try clone or insert from one to another table with one by one table the query except id, created and modified, and with saveMany, there all sucessfull, but iam cofusing how to merger data, from old file to new file,
Example,
I have record with sesi_periode 2018/2019 with contain or assosciated subrecord or list item, i want close periode with logic : backup record and contain to another table and update record to new sesi_periode ex 2019/2020, and before i had record with sesi_periode 2019/2020 with code file not same, how to merge it, i want contain or record on relation from sesi_periode 2018/2019 combine or merger with sesi_periode 2019/202020