You are here

public function ConnectionService::getConnections in RedHen CRM 8

Returns the connections to this entity.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity we're querying against.

\Drupal\Core\Entity\EntityInterface $entity2: The second entity we're querying against.

string $connection_type: (optional) Limit returned connections to this type.

bool $active: (optional) Return only active connections.

Return value

array The Connection entities connected to this entity.

Overrides ConnectionServiceInterface::getConnections

2 calls to ConnectionService::getConnections()
ConnectionService::checkConnectionPermission in modules/redhen_connection/src/ConnectionService.php
Check entity access via its connections & current user's connection roles.
ConnectionService::getConnectedEntities in modules/redhen_connection/src/ConnectionService.php
Returns the other entities that are connected to this entity.

File

modules/redhen_connection/src/ConnectionService.php, line 120

Class

ConnectionService
Provides an interface for getting connections between entities.

Namespace

Drupal\redhen_connection

Code

public function getConnections(EntityInterface $entity, EntityInterface $entity2 = NULL, $connection_type = NULL, $active = TRUE) {
  $connections = [];
  $connections_matches = $this
    ->connectionQuery($entity, $entity2, $connection_type, $active);
  if (!empty($connections_matches)) {
    $connections = Connection::loadMultiple($connections_matches);
  }
  return $connections;
}