You are here

final class MappingForeignRelationshipsEvent in Search API 8

Wraps a foreign relationships mapping event.

Hierarchy

Expanded class hierarchy of MappingForeignRelationshipsEvent

1 file declares its use of MappingForeignRelationshipsEvent
TrackingHelper.php in src/Utility/TrackingHelper.php

File

src/Event/MappingForeignRelationshipsEvent.php, line 14

Namespace

Drupal\search_api\Event
View source
final class MappingForeignRelationshipsEvent extends Event {

  /**
   * The index whose foreign relationships are mapped.
   *
   * @var \Drupal\search_api\IndexInterface
   */
  protected $index;

  /**
   * Reference to the foreign relationships mapping.
   *
   * @var array
   */
  protected $foreignRelationshipsMapping;

  /**
   * Cacheability associated with the foreign relationships mapping.
   *
   * @var \Drupal\Core\Cache\RefinableCacheableDependencyInterface
   */
  protected $cacheability;

  /**
   * Constructs a new class instance.
   *
   * @param \Drupal\search_api\IndexInterface $index
   *   The index whose foreign relationships are mapped.
   * @param array $foreign_relationships_mapping
   *   The foreign relationships that were already found.
   * @param \Drupal\Core\Cache\RefinableCacheableDependencyInterface $cacheability
   *   The cacheability associated with the foreign relationships mapping.
   */
  public function __construct(IndexInterface $index, array &$foreign_relationships_mapping, RefinableCacheableDependencyInterface $cacheability) {
    $this->index = $index;
    $this->foreignRelationshipsMapping =& $foreign_relationships_mapping;
    $this->cacheability = $cacheability;
  }

  /**
   * Retrieves the index whose foreign relationships are mapped.
   *
   * @return \Drupal\search_api\IndexInterface
   *   The index whose foreign relationships are mapped.
   */
  public function getIndex() : IndexInterface {
    return $this->index;
  }

  /**
   * Retrieves a reference to the foreign relationships mapping.
   *
   * @return array[]
   *   A (numerically keyed) array of foreign relationship mappings. Each
   *   sub-array here represents a single known relationship. Such sub-arrays
   *   will have the following structure:
   *   - datasource: (string) The ID of the datasource which contains this
   *     relationship.
   *   - entity_type: (string) Entity type that is referred to from the index.
   *   - bundles: (array) Optional array of particular entity bundles that are
   *     referred to from the index. Empty array here means index refers to
   *     all the bundles.
   *   - property_path_to_foreign_entity: (string) Property path where the index
   *     refers to this entity.
   *   - field_name: (string) Name of the field on the referenced entity that
   *     actively participates in the search index.
   */
  public function &getForeignRelationshipsMapping() : array {
    return $this->foreignRelationshipsMapping;
  }

  /**
   * Retrieves cacheability associated with the foreign relationships mapping.
   *
   * @return \Drupal\Core\Cache\RefinableCacheableDependencyInterface
   *   Cacheability associated with the foreign relationships mapping.
   */
  public function getCacheability() : RefinableCacheableDependencyInterface {
    return $this->cacheability;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MappingForeignRelationshipsEvent::$cacheability protected property Cacheability associated with the foreign relationships mapping.
MappingForeignRelationshipsEvent::$foreignRelationshipsMapping protected property Reference to the foreign relationships mapping.
MappingForeignRelationshipsEvent::$index protected property The index whose foreign relationships are mapped.
MappingForeignRelationshipsEvent::getCacheability public function Retrieves cacheability associated with the foreign relationships mapping.
MappingForeignRelationshipsEvent::getForeignRelationshipsMapping public function Retrieves a reference to the foreign relationships mapping.
MappingForeignRelationshipsEvent::getIndex public function Retrieves the index whose foreign relationships are mapped.
MappingForeignRelationshipsEvent::__construct public function Constructs a new class instance.