You are here

trait ContentHubEntityTrait in Acquia Content Hub 8

Same name in this branch
  1. 8 tests/src/Functional/ContentHubEntityTrait.php \Drupal\Tests\acquia_contenthub\Functional\ContentHubEntityTrait
  2. 8 tests/src/Unit/ContentHubEntityTrait.php \Drupal\Tests\acquia_contenthub\Unit\ContentHubEntityTrait

Content Hub Entity Trait.

Hierarchy

File

tests/src/Functional/ContentHubEntityTrait.php, line 8

Namespace

Drupal\Tests\acquia_contenthub\Functional
View source
trait ContentHubEntityTrait {

  /**
   * Origin of the entity.
   *
   * @var string
   */
  private $origin = '2c8b1237-1ee6-453e-aa11-3edf9e9c5f9d';

  /**
   * Timestamp of last modification.
   *
   * @var string
   */
  private $modified = '';

  /**
   * Convert an regular entity to Content Hub entity.
   *
   * @param object $entity
   *   A Drupal entity.
   */
  private function convertToContentHubEntity($entity) {
    $imported_entity = $this->container
      ->get('acquia_contenthub.acquia_contenthub_entities_tracking')
      ->setImportedEntity($entity
      ->getEntityTypeId(), $entity
      ->id(), $entity
      ->uuid(), $this->modified, $this->origin);
    $imported_entity
      ->save();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ContentHubEntityTrait::$modified private property Timestamp of last modification.
ContentHubEntityTrait::$origin private property Origin of the entity.
ContentHubEntityTrait::convertToContentHubEntity private function Convert an regular entity to Content Hub entity.