Problem/Motivation

`drush dce node 1` prints json to the console.
`drush dcer node 1` quietly prints to current location.

Proposed resolution

Rectify behavior so that the two commands act the same.

Remaining tasks

Find consensus, patch, commit

I see three of ways to bring the two commands into alignment. I personally like the way `dce` prints to the console, so I wrote a patch that does the same for `dcer` instead of printing to the current location.

Perhaps the more sensible option, which keeps behavior in line with current behavior, is to make all the arguments required.

Comments

icicleking created an issue. See original summary.

icicleking’s picture

Issue summary: View changes
icicleking’s picture

Status: Active » Needs work
mariodan’s picture

I have tested patch #1 and it works as described.

mariodan’s picture

Status: Needs work » Reviewed & tested by the community
andypost’s picture

+++ b/src/DefaultContentManager.php
@@ -302,10 +302,18 @@ class DefaultContentManager implements DefaultContentManagerInterface {
+      else {
+        foreach ($serialized_entities as $uuid => $serialized_entity) {
+          drush_print($serialized_entity);

any reason for that?

kalpaitch’s picture

Status: Reviewed & tested by the community » Needs work

I suspect because as rightly pointed out there is still some inconsistency with the drush commands (also found when adding the import commands).

The 'file' option on the 'default-content-export' command will 'Write out the exported content to a file instead of stdout'. Therefore the default behaviour of this command is to write to stout, however none of the other commands follow this behaviour. I guess the suggestion is that either all the export commands should write to stout if not given a file system to write to, or they should all do nothing. Same goes for 'default-content-export-module' command potentially.

Either way the descriptions of the 'file' or 'folder' flags needs to be more explicit.

kalpaitch’s picture

StatusFileSize
new3.24 KB

Re-rolled based on #2614644: Split DefaultContentManager into Exporter and Importer

Made the 'default-content-export' command use the new 'writeDefaultContent' method on the exporter service, and removed the stdout to console.

kalpaitch’s picture

Status: Needs work » Needs review
berdir’s picture

Version: 8.x-1.0-alpha3 » 2.0.x-dev
Category: Bug report » Feature request
Status: Needs review » Needs work

I've been thinking about switching drush dce in 2.0.x to a folder argument instead of this, so I like the direction and I'm also OK with API/drush command changes there at the moment. I think we could also use this issue to address #2870993: Make location for exported content more useful when folder option is ommited and ensure we export into the real current folder and not drupal root.

This also needs to implement this for drush 9+.

kevinfunk’s picture

StatusFileSize
new11.67 KB

I have a need to only export nodes and not references. I added this feature while working on this issue. Please let me know if you think it doesn't belong as part of this issue.

Export all nodes (does not export references)
drush dce node --folder=modules/custom/my_custom_module/content

Export only node 1
drush dce node 1 --folder=modules/custom/my_custom_module/content

kevinfunk’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 11: default_content-2824103-11.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

kevinfunk’s picture

StatusFileSize
new12.53 KB