Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DataObject] copy/persistence of FieldCollection field between 2 objects #4277

FredoVelcro opened this issue Apr 25, 2019 · 0 comments


None yet
1 participant
Copy link

commented Apr 25, 2019


I have a Product object with a FieldCollection field (docsList).
Each item is a composed field with a title (string) and a PDF document (Asset\Document).
When trying to simply copy fields between 2 objects, the destination product has the FieldCollection with all items BUT the document object is not linked/set :

// the easy way i would like to do this :

I am forced to do a tricky thing like :

$copyDownloadableDocuments = function (Fieldcollection $collection = null) {
                if (!$collection) {
                    return null;

                $docs = new Fieldcollection();
                foreach ($collection as $doc) {
                    /** @var \Pimcore\Model\DataObject\Fieldcollection\Data\DownloadableDocument $doc */
                    $copyDoc = new Fieldcollection\Data\DownloadableDocument();


                return $docs;


What is the right way to easy copy FieldCollection between 2 products ?
Is it a matter of dirtyMap (already tried...), lazy loading or something else ?

Thank you for any help / good practice to do this.

Best regards,


@FredoVelcro FredoVelcro changed the title [DataObject] copy/persistence od FieldCollection fields between 2 objects [DataObject] copy/persistence of FieldCollection field between 2 objects Apr 25, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.