You are here

interface ConnectionServiceInterface in RedHen CRM 8

Provides an interface for getting connections between entities.

Hierarchy

Expanded class hierarchy of ConnectionServiceInterface

All classes that implement ConnectionServiceInterface

File

modules/redhen_connection/src/ConnectionServiceInterface.php, line 10

Namespace

Drupal\redhen_connection
View source
interface ConnectionServiceInterface {

  /**
   * Filters entity list to bundle definitions for entities w/ connection types.
   *
   * @param EntityTypeInterface[] $entity_types
   *   The master entity type list filter.
   *
   * @return ConfigEntityTypeInterface[]
   *   An array of only the config entities we want to modify.
   */
  public function getConnectionEntityTypes(array $entity_types);

  /**
   * Returns connection types that can be connected to 1 or 2 entities.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   Entity 1.
   * @param \Drupal\Core\Entity\EntityInterface $entity2
   *   Entity 2.
   *
   * @return array
   *   Connection types that can be used between the 1 or 2 entities.
   */
  public function getConnectionTypes(EntityInterface $entity, EntityInterface $entity2 = NULL);

  /**
   * Returns the connections to this entity.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The entity we're querying against.
   * @param \Drupal\Core\Entity\EntityInterface $entity2
   *   The second entity we're querying against.
   * @param string $connection_type
   *   (optional) Limit returned connections to this type.
   * @param bool $active
   *   (optional) Return only active connections.
   *
   * @return array
   *   The Connection entities connected to this entity.
   */
  public function getConnections(EntityInterface $entity, EntityInterface $entity2 = NULL, $connection_type = NULL, $active = TRUE);

  /**
   * Returns the number of connections to this entity.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The entity we're querying against.
   * @param \Drupal\Core\Entity\EntityInterface $entity2
   *   The entity we're querying against.
   * @param string $connection_type
   *   (optional) Limit returned connections to this type.
   *
   * @return int
   *   The number of Connection entities connected to this entity.
   */
  public function getConnectionCount(EntityInterface $entity, EntityInterface $entity2 = NULL, $connection_type = NULL);

  /**
   * Returns the other entities that are connected to this entity.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The entity we're querying against.
   * @param string $connection_type
   *   (optional) Limit returned entities to ones connected via this type.
   *
   * @return array
   *   The connected entities for this entity.
   */
  public function getConnectedEntities(EntityInterface $entity, $connection_type = NULL);

  /**
   * Check entity access via its connections & current user's connection roles.
   *
   * @param \Drupal\Core\Entity\EntityInterface $endpoint1
   *   Endpoint 1 of the connection.
   * @param \Drupal\Core\Entity\EntityInterface $endpoint2
   *   Endpoint 2 of the connection.
   * @param string $operation
   *   The entity operation (view, view label, update, delete, create)
   * @param string $permission_key
   *   Key for checking permissions against.
   *
   * @return \Drupal\Core\Access\AccessResultInterface
   *   Access result, either neutral or allowed.
   */
  public function checkConnectionPermission(EntityInterface $endpoint1, EntityInterface $endpoint2, $operation, $permission_key);

  /**
   * Get all entities that are used in connections.
   *
   * @return array
   *   An array of entity_types.
   */
  public function getAllConnectionEntityTypes();

}

Members

Namesort descending Modifiers Type Description Overrides
ConnectionServiceInterface::checkConnectionPermission public function Check entity access via its connections & current user's connection roles. 1
ConnectionServiceInterface::getAllConnectionEntityTypes public function Get all entities that are used in connections. 1
ConnectionServiceInterface::getConnectedEntities public function Returns the other entities that are connected to this entity. 1
ConnectionServiceInterface::getConnectionCount public function Returns the number of connections to this entity. 1
ConnectionServiceInterface::getConnectionEntityTypes public function Filters entity list to bundle definitions for entities w/ connection types. 1
ConnectionServiceInterface::getConnections public function Returns the connections to this entity. 1
ConnectionServiceInterface::getConnectionTypes public function Returns connection types that can be connected to 1 or 2 entities. 1