Hi,

Your module is exactly what I'm looking for.
I haven't any bug. :-)

However it doesn't support Field_Collection both for export and import.
By the way, the support of "file" as sub field.

I'm open to contribute on this project.
Don't hesitate to contact me.

BR

Comments

bailey86’s picture

Thanks for getting in touch.

I'll need to look at this - maybe you could send through a rough plan you may have.

In the meantime you might find Bundle Copy - https://drupal.org/project/bundle_copy - to be of use for exporting/importing the field collections. I've heard it works with field collections but not tested it myself.

It might be that we can think of Field Collections as structure and not data - but I'm open to suggestions.

sebastien m.’s picture

Tomorrow I will send you my implementation.
I have tested it and it seems to work with simple and complex cases.

rooby’s picture

Title: Support for Field_Collection » Add support for field collections
Version: 7.x-1.3 » 7.x-1.x-dev
Priority: Major » Normal
Status: Needs work » Active

Feature requests are for the dev version, priority is always normal for feature & support requests and the needs work status is for issues that have a patch and the patch still needs work.

See https://drupal.org/node/156119 and https://drupal.org/node/45111

bailey86’s picture

Hi,

I'm doing some work on the module currently so if you have a patch available do you want to send it through and I'll see about applying it.

Cheers,

Kevin B

sebastien m.’s picture

StatusFileSize
new6.73 KB
new17.66 KB

Hi,

Currently I haven't any patch to apply, however, I can send you the code I'm using to build a node before sending it and the one to import the node.

Here is a description of each functions :

_profile_maker_content_get_field_by_type : this function return an array of fields filtered by type :

  // List specific field.
  $fields_of_type_file             = _profile_maker_content_get_field_by_type($node_type, array('file', 'image'));
  $fields_of_type_field_collection = _profile_maker_content_get_field_by_type($node_type, array('field_collection'));

_profile_maker_content_export_nodes : this function prepare the content to be stored into file

  $content = _profile_maker_content_export_nodes('article', '');

_profile_maker_content_export_node : this function will select each node and encode/export it
(internally called by _profile_maker_content_export_nodes)

_profile_maker_content_export_node_recurse : this is the most important function. recursively, the node will be prepared before export
(internally called by _profile_maker_content_export_node)

Functions containing "import" will make the some work but in the other way.
As far as I remember, I haven't changed your function called "*import*with_defined_id".

Feel free to contact me for any question.
BR

cf : I made you an extract "import_export_field_collection.txt" of my module to highlight functions which match the more your code.
The full code is in the file "profile_maker_content.module".

bailey86’s picture

Status: Active » Closed (works as designed)

I'm going to mark this as closed as field collections are structure and not data - and I'd prefer to keep the distinction clear.

I think there are other modules available which can export/import field collections.

sebastien m.’s picture

Field collections are structure.
Do you know exactly what is it ?

It's a kind of "sub content type", a set of fields which are connected directly to a node type, but which hasn't any specific existence.

It's not easy to explain with a simple sentence.

bailey86’s picture

Hiya,

I have looked at them - I'm not sure but I still think this is more structure.

For example - say you have two sites - and both have the same content types set up - with the same field collections in the content types. Are you able to export nodes from one site and import them into the other site with this module?

I.e. - if the content types are the same - can DEI be used to export nodes from one site to another?

sebastien m.’s picture

If you use the sample code I have provided to you, field_collection content can be export from the first site and imported to the second one.

However, the structure of field_collection and content type needs to be updated previously by another module like for example bulk export or something like.

bailey86’s picture

So - I take it that the code/patch is needed to export/import field_collection node data. I'll need to look into it to see if the code/patch can be added without affecting current content types - or whether the code should be used conditionally based on the presence/absence of the field_collection module.

If you could provide the code as a patch I'd certainly look at adding it in.

Thanks,

Kev

rooby’s picture

Field collections are structure like content types are structure.

Field collection data is content like node data is content.

Really this module should be able to handle field collection data.

The usage rate of field collections is quite high and this module is currently useless for any site with field collections.

bailey86’s picture

I'd like to get this added so I'm going to leave this issue open.

This is how the module works - this is to help in case anyone wants to help out with a patch.

When the module exports a node it does it like this.

* The node object is created from from the ID number using the API.
* Attached files/images are found using the API - the files are converted to character strings, built up as arrays and then attached to the node object as extra attributes.
* The node objects are then serialized, base64 encoded and sent out to the dataset file.

On import:
* The lines in the file are read.
* Each line is unbase64 encoded, deserialized and then the objects are recreated.
* The code then looks for files which have been attached to the node object and saves the files.
* The file ID numbers are then added to the node object as attached files.
* The node objects are then saved using the API.

I think what needs to be added is similar to how files are added. I.e. when a node object has been created the field collection data needs to be found (via the API?) and then this data needs to be added to the node object before the node object is exported. On import the process would be reversed.

I'm currently too busy to add it myself - but would look at any patches sent in. Also, sponsorship to add this functionality would be another way to get it added.

bailey86’s picture

Issue summary: View changes
Status: Closed (works as designed) » Needs work
ecvandenberg’s picture

What is the status for this issue? Seems that it is not yet implemented in the latest version 7.x-1.7 which is newer than the latest dev.

rooby’s picture

Something funky going on with releases on this project then.

There is a commit from November in 7.x-1.x and if I download the dev version the latest commit is in there, but the date on that download still says September.

Maybe something to follow up in the drupal infrastructure issue queue unless the maintainer can work out what is going wrong with it.

ecvandenberg’s picture

I have just installed the 7.x-1.x-dev dated 2013-Sep-30 on a fresh Drupal 7.28 site. And to my humble opinion Field collection data is not supported. I tested this as follows:

  • Install a fresh Drupal core 7.28
  • Install Entity API 7.x-1.5
  • Install Field collection 7.x-1.0-beta7
  • Install Data export import 7.x-1.7
  • Create a content type with a field collection and add some content to both the node body and the field collection.
  • Export all nodes to a dataset file with the Data export import module.
  • Change the content of the node body and the field collection.
  • Import the dataset you just exported.
  • The node body is updated to its state before the export, but the field collection is not.
Rhodungeon’s picture

I can confirm that actually field collection is not supported. With this feature, this module will be a must for any Drupal website.

bailey86’s picture

Hi,

Thanks for looking at this.

I'm currently on a contract role and so no spare time to look to implement this. If anyone is interested they could request to become a maintainer and I'll look to add them so they could implement field collection.

Cheers,

Kev

sumithb’s picture

Issue tags: +Please add support for field collection as well.

Hi,

Please add support for field collection as well. No other module is as simple as this module to migrate data.

Thanks
Sumith

baseconversion’s picture

I agree. I think we should help make this module more robust, as it is excellent.