You are here

class RuntimeImportContext in Entity Share 8.3

Class RuntimeImportContext.

Contains properties to store data during import.

@package Drupal\entity_share_client

Hierarchy

Expanded class hierarchy of RuntimeImportContext

12 files declare their use of RuntimeImportContext
BlockFieldBlockContentImporter.php in modules/entity_share_client/src/Plugin/EntityShareClient/Processor/BlockFieldBlockContentImporter.php
ChangedTime.php in modules/entity_share_client/src/Plugin/EntityShareClient/Processor/ChangedTime.php
DefaultDataProcessor.php in modules/entity_share_client/src/Plugin/EntityShareClient/Processor/DefaultDataProcessor.php
EmbeddedEntityImporter.php in modules/entity_share_client/src/Plugin/EntityShareClient/Processor/EmbeddedEntityImporter.php
EntityReference.php in modules/entity_share_client/src/Plugin/EntityShareClient/Processor/EntityReference.php

... See full list

File

modules/entity_share_client/src/RuntimeImportContext.php, line 17

Namespace

Drupal\entity_share_client
View source
class RuntimeImportContext {

  /**
   * The remote.
   *
   * @var \Drupal\entity_share_client\Entity\RemoteInterface
   */
  protected $remote;

  /**
   * The channel's identifier.
   *
   * @var string
   */
  protected $channelId;

  /**
   * The channel's Label.
   *
   * @var string
   */
  protected $channelLabel;

  /**
   * The channel's URL.
   *
   * @var string
   */
  protected $channelUrl;

  /**
   * The channel's URL UUID.
   *
   * @var string
   */
  protected $channelUrlUuid;

  /**
   * The channel's entity type.
   *
   * @var string
   */
  protected $channelEntityType;

  /**
   * The channel's bundle.
   *
   * @var string
   */
  protected $channelBundle;

  /**
   * The channel's search configuration.
   *
   * @var array
   */
  protected $channelSearchConfiguration;

  /**
   * The remote field mappings.
   *
   * @var array
   */
  protected $fieldMappings;

  /**
   * The import service used for the import.
   *
   * @var \Drupal\entity_share_client\Service\ImportServiceInterface
   */
  protected $importService;

  /**
   * The list of the currently imported entities.
   *
   * @var array
   */
  protected $importedEntities = [];

  /**
   * Getter.
   *
   * @return \Drupal\entity_share_client\Entity\RemoteInterface
   *   The remote.
   */
  public function getRemote() : RemoteInterface {
    return $this->remote;
  }

  /**
   * Setter.
   *
   * @param \Drupal\entity_share_client\Entity\RemoteInterface $remote
   *   The remote.
   */
  public function setRemote(RemoteInterface $remote) : void {
    $this->remote = $remote;
  }

  /**
   * Getter.
   *
   * @return string
   *   The channel's identifier.
   */
  public function getChannelId() : string {
    return $this->channelId;
  }

  /**
   * Setter.
   *
   * @param string $channel_id
   *   The channel's identifier.
   */
  public function setChannelId(string $channel_id) : void {
    $this->channelId = $channel_id;
  }

  /**
   * Getter.
   *
   * @return string
   *   The channel's Label.
   */
  public function getChannelLabel() : string {
    return $this->channelLabel;
  }

  /**
   * Setter.
   *
   * @param string $channelLabel
   *   The channel's Label.
   */
  public function setChannelLabel(string $channelLabel) : void {
    $this->channelLabel = $channelLabel;
  }

  /**
   * Getter.
   *
   * @return string
   *   The channel's URL.
   */
  public function getChannelUrl() : string {
    return $this->channelUrl;
  }

  /**
   * Setter.
   *
   * @param string $channelUrl
   *   The channel's URL.
   */
  public function setChannelUrl(string $channelUrl) : void {
    $this->channelUrl = $channelUrl;
  }

  /**
   * Getter.
   *
   * @return string
   *   The channel's URL UUID.
   */
  public function getChannelUrlUuid() : string {
    return $this->channelUrlUuid;
  }

  /**
   * Setter.
   *
   * @param string $channelUrlUuid
   *   The channel's URL UUID.
   */
  public function setChannelUrlUuid(string $channelUrlUuid) : void {
    $this->channelUrlUuid = $channelUrlUuid;
  }

  /**
   * Getter.
   *
   * @return string
   *   The channel's entity type.
   */
  public function getChannelEntityType() : string {
    return $this->channelEntityType;
  }

  /**
   * Setter.
   *
   * @param string $channelEntityType
   *   The channel's entity type.
   */
  public function setChannelEntityType(string $channelEntityType) : void {
    $this->channelEntityType = $channelEntityType;
  }

  /**
   * Getter.
   *
   * @return string
   *   The channel's bundle.
   */
  public function getChannelBundle() : string {
    return $this->channelBundle;
  }

  /**
   * Setter.
   *
   * @param string $channelBundle
   *   The channel's bundle.
   */
  public function setChannelBundle(string $channelBundle) : void {
    $this->channelBundle = $channelBundle;
  }

  /**
   * Getter.
   *
   * @return array
   *   The channel's search configuration.
   */
  public function getChannelSearchConfiguration() : array {
    return $this->channelSearchConfiguration;
  }

  /**
   * Setter.
   *
   * @param array $channelSearchConfiguration
   *   The channel's search configuration.
   */
  public function setChannelSearchConfiguration(array $channelSearchConfiguration) : void {
    $this->channelSearchConfiguration = $channelSearchConfiguration;
  }

  /**
   * Getter.
   *
   * @return array
   *   The remote field mappings.
   */
  public function getFieldMappings() : array {
    return $this->fieldMappings;
  }

  /**
   * Setter.
   *
   * @param array $fieldMappings
   *   The remote field mappings.
   */
  public function setFieldMappings(array $fieldMappings) : void {
    $this->fieldMappings = $fieldMappings;
  }

  /**
   * Getter.
   *
   * @return \Drupal\entity_share_client\Service\ImportServiceInterface
   *   The import service used for the import.
   */
  public function getImportService() : ImportServiceInterface {
    return $this->importService;
  }

  /**
   * Setter.
   *
   * @param \Drupal\entity_share_client\Service\ImportServiceInterface $importService
   *   The import service used for the import.
   */
  public function setImportService(ImportServiceInterface $importService) : void {
    $this->importService = $importService;
  }

  /**
   * Getter.
   *
   * @return array
   *   The imported entities.
   */
  public function getImportedEntities() : array {
    return $this->importedEntities;
  }

  /**
   * Clear imported entities.
   *
   * @param string $langcode
   *   The language code to reset.
   * @param string $entity_uuid
   *   The entity UUID to reset.
   */
  public function clearImportedEntities($langcode = '', $entity_uuid = '') {
    if (empty($langcode) && empty($entity_uuid)) {
      $this->importedEntities = [];
    }
    elseif (!empty($langcode) && empty(!$entity_uuid) && isset($this->importedEntities[$langcode][$entity_uuid])) {
      unset($this->importedEntities[$langcode][$entity_uuid]);
    }
    elseif (!empty($langcode) && isset($this->importedEntities[$langcode])) {
      $this->importedEntities[$langcode] = [];
    }
    elseif (!empty($entity_uuid)) {
      foreach (array_keys($this->importedEntities) as $imported_entities_langcode) {
        if (isset($this->importedEntities[$imported_entities_langcode][$entity_uuid])) {
          unset($this->importedEntities[$imported_entities_langcode][$entity_uuid]);
        }
      }
    }
  }

  /**
   * Register that an entity translation has been imported.
   *
   * @param string $langcode
   *   The language code of the translation.
   * @param string $entity_uuid
   *   The entity UUID.
   */
  public function addImportedEntity($langcode, $entity_uuid) {
    $this->importedEntities[$langcode][$entity_uuid] = $entity_uuid;
  }

  /**
   * Check if an entity translation has been imported.
   *
   * @param string $langcode
   *   The language code of the translation.
   * @param string $entity_uuid
   *   The entity UUID.
   *
   * @return bool
   *   TRUE if the translation had been imported. FALSE otherwise.
   */
  public function isEntityTranslationImported($langcode, $entity_uuid) {
    if (isset($this->importedEntities[$langcode][$entity_uuid])) {
      return TRUE;
    }
    else {
      return FALSE;
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
RuntimeImportContext::$channelBundle protected property The channel's bundle.
RuntimeImportContext::$channelEntityType protected property The channel's entity type.
RuntimeImportContext::$channelId protected property The channel's identifier.
RuntimeImportContext::$channelLabel protected property The channel's Label.
RuntimeImportContext::$channelSearchConfiguration protected property The channel's search configuration.
RuntimeImportContext::$channelUrl protected property The channel's URL.
RuntimeImportContext::$channelUrlUuid protected property The channel's URL UUID.
RuntimeImportContext::$fieldMappings protected property The remote field mappings.
RuntimeImportContext::$importedEntities protected property The list of the currently imported entities.
RuntimeImportContext::$importService protected property The import service used for the import.
RuntimeImportContext::$remote protected property The remote.
RuntimeImportContext::addImportedEntity public function Register that an entity translation has been imported.
RuntimeImportContext::clearImportedEntities public function Clear imported entities.
RuntimeImportContext::getChannelBundle public function Getter.
RuntimeImportContext::getChannelEntityType public function Getter.
RuntimeImportContext::getChannelId public function Getter.
RuntimeImportContext::getChannelLabel public function Getter.
RuntimeImportContext::getChannelSearchConfiguration public function Getter.
RuntimeImportContext::getChannelUrl public function Getter.
RuntimeImportContext::getChannelUrlUuid public function Getter.
RuntimeImportContext::getFieldMappings public function Getter.
RuntimeImportContext::getImportedEntities public function Getter.
RuntimeImportContext::getImportService public function Getter.
RuntimeImportContext::getRemote public function Getter.
RuntimeImportContext::isEntityTranslationImported public function Check if an entity translation has been imported.
RuntimeImportContext::setChannelBundle public function Setter.
RuntimeImportContext::setChannelEntityType public function Setter.
RuntimeImportContext::setChannelId public function Setter.
RuntimeImportContext::setChannelLabel public function Setter.
RuntimeImportContext::setChannelSearchConfiguration public function Setter.
RuntimeImportContext::setChannelUrl public function Setter.
RuntimeImportContext::setChannelUrlUuid public function Setter.
RuntimeImportContext::setFieldMappings public function Setter.
RuntimeImportContext::setImportService public function Setter.
RuntimeImportContext::setRemote public function Setter.