Problem/Motivation

I'm attempting to use the smart_date:migrate drush script as described in the "Migrating Data From Core Date Fields" documentation and encountering an error:

$ drush smart_date:migrate event_program field_when field_event_date
Starting date migration.

In EntityTypeManager.php line 143:

The "" entity type does not exist.

Steps to reproduce

In the above example, "event_program" is the content type, "field_when" is the destination Smart Date field, and "field_event_date" is where the data will be drawn from.

I'm using Drupal 9.3.4, Drush 10.6.2, and Smart Date 3.5.0.

Previously this worked with earlier versions of Drupal 9, Drush, and Smart Date, but having upgraded all of them since, I'm at a loss to know what is causing the error now.

CommentFileSizeAuthor
#6 smart_date-drush_broken-3262983-6.patch972 bytesmandclu

Comments

sclsweb created an issue. See original summary.

sclsweb’s picture

Issue summary: View changes
sclsweb’s picture

Aha. It works as expected when --entity=node is specified in the drush command, like so:

$ drush smart_date:migrate event_program field_when field_event_date --entity=node

Smart Date 3.5.0 declares a default value for 'entity' in SmartDateDrushCommands.php, differently than in prior versions:

public function migrate($bundle, $dest, $source_start, $source_end = NULL, $source_all_day = NULL, array $options = NULL) {
    if (!$options) {
      $options = [
        'clear' => FALSE,
        'entity' => 'node',
        'default_duration' => 0,
        'langcode' => NULL,
      ];
    }

The check on $options seems to be failing here(?).

Smart Date 3.4.3 has:
public function migrate($bundle, $dest, $source_start, $source_end = NULL, $source_all_day = NULL, $options = ['clear' => FALSE, 'entity' => 'node', 'default_duration' => 0, 'langcode' => NULL]) {

sclsweb’s picture

After updating to Drupal core 9.3.5, the workaround of specifying the entity value in the drush command no longer works.

$ drush smart_date:migrate event_program field_when field_event_date --entity=node

Gives the error, 'The "--entity" option does not accept a value.'

Rolling back to Smart_date 3.4.3, the drush command still works.

sclsweb’s picture

Version: 3.5.0 » 3.5.x-dev
mandclu’s picture

Status: Active » Needs review
StatusFileSize
new972 bytes

The change that seems to have created so many problems with the drush command was originally to address some code standards issues, but breaking the command entirely is a poor bargain.

This patch reverts that change, which hopefully will resolve the cited problem.

  • mandclu committed 2cb1bbd on 3.5.x
    Issue #3262983 by mandclu: drush smart_date:migrate / The "" entity type...
mandclu’s picture

This change was actually merged in as part of #3264802: Import Drush command doesn't work with date-only values, or all day timezones, so marking this as fixed. Feel free to re-open if additional work is needed.

mandclu’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.