Closed (fixed)
Project:
Default Content
Version:
2.0.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
10 Apr 2016 at 17:16 UTC
Updated:
6 Sep 2024 at 22:09 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
sam152 commentedComment #3
andyposthere's some typos
Comment #4
pguillard commentedJust corrected the typos
Comment #5
Algeron commented#4 works on latest dev.
Comment #6
Algeron commentedWhen a module .info file marks an entity for export AND that same entity is detected as a reference by another entity, the result is that the entity gets exported twice in the same .json file, producing invalid syntax.
Steps to reproduce:
- Create 2 content types. #1 just has a title. #2 has a title and an entity reference field to #1.
- Create a node for each. In node 2, reference node 1.
- Create a module for use with
default-content-export-module-with-references. Add the UUIDs of nodes 1 and 2 in this file. Export the content.Result:
The JSON file for node 1 will contain duplicate output. There will be two top-level JSON tags, which is considered invalid syntax. Attempting to re-import the files will result in an error.
Comment #7
Algeron commentedUpdated patch in attachment. Sadly it conflicts with #2815051: Skip exporting core users by default.
Comment #9
pguillard commentedPatch rerolled
Comment #10
aaronbauman+1 for this feature.
Should we also alert the user about new content that was exported?
Otherwise, how will we update the .info.yml file with the new UUIDs?
Comment #11
pguillard commentedComment #12
dawehnerIMHO some level of test coverage would be super helpful.
Comment #13
larowlanThis needs to go on the exporter now we've split the two. Needs a docblock too
And, yep - needs tests - could use vfsStream to simulate file system.
Comment #14
aaronbaumanHere's a reroll.
Comment #15
larowlanThanks, we just need a test now - nice work.
Comment #16
eelkeblokWould it make sense to fold this functionality into the dcer command, with a --module option?
Comment #17
jurriaanroelofs commentedGreat, +1, but I got an error because there was still a reference to the manager service. Here's a fixed patch and interdiff.
Comment #18
joachim commented> Would it make sense to fold this functionality into the dcer command, with a --module option?
+1 to that.
Also, this is going to need to be ported to Drush 9.
Comment #19
joachim commentedI've added the Drush 9 command.
> Would it make sense to fold this functionality into the dcer command, with a --module option?
Don't have the time to do that, I'm afraid, so will leave that for the next person who can push this forward a little!
Comment #20
marios anagnostopoulos commented2.0.x uses a completely different normalization implementation that does not depend on hal.module anymore.
Does this make this issue's progress up to #19 obsolete?
Comment #23
justafishI've created a new drush command that works with 2.0.x
Comment #24
damienmckennaI've tested the latest merge request from justafish and it works great.
Comment #25
damienmckennaHiding the files, which were for the 8.x-1.x branch.
Comment #26
damienmckennaThe only issue I have is that I'd like to be able to define entity types not to export, e.g. the "user" entity. For example, if I export a block that has a media item, which has a file record and then a file, which all point to a user object, the command exports the block, media, file items and the file itself, but not the user. That said, the improvement could be done as a follow-up.
Comment #29
berdirMerged, after rebasing to remove the .drush.inc changes (which is now removed).
Never used the module based exports myself, doing that with recipes in the future might be more useful, we'll see.