EntityValidationException example

    // surrounding the row import and then added to the migration messages table     // for the current row.     try {
      $violations = $entity->validate();
    } finally {
      if ($account) {
        $this->accountSwitcher->switchBack();
      }
    }

    if (count($violations) > 0) {
      throw new EntityValidationException($violations);
    }
  }

  /** * Saves the entity. * * @param \Drupal\Core\Entity\ContentEntityInterface $entity * The content entity. * @param array $old_destination_id_values * (optional) An array of destination ID values. Defaults to an empty array. * * @return array * An array containing the entity ID. */
Home | Imprint | This part of the site doesn't use cookies.