Closed ascheider closed 11 months ago
If i change something and reimport the item, i always get a new collection item in the object.
This is on purpose. When you want to keep some of the current field collection items while removing others, please enable Truncate before import
checkbox and then use $params['currentValue']
to loop through currently assigned field collection items. The ones which you want to keep you put into an array. And to this array you also add the ones which the import shall create. Then you return the array and have your desired items in the field collection.
@BlackbitDevs Thanks for quick reply. CurrentValue seems not be present on this point.
I guess i need to load the object here and extract the data via getter.
No, it is present but currently there are no items in the field collection, that's why you get an empty array (= []
)
I guess i need to load the object here and extract the data via getter.
When you have this thought on any place when you use Data Director, there most often is an easier way. The whole purpose of this bundle is to not have to learn about all those PHP and Pimcore internals.
@BlackbitDevs you are right, the entities present in the currentValue. It works like you described.
we have a field collection which is named Pcm
The collection contains some fields which are imported:
If i change something and reimport the item, i always get a new collection item in the object.
![image](https://github.com/BlackbitDigitalCommerce/pimcore-data-director/assets/6016485/87162916-b881-4f0d-aae9-f73145a0d981)
The question is, how can i identify the item and update the collection item instead of creating new one? I did not found any examples in the book or am i blind? Thank you!