You are here

public function ConnectionService::getConnectionCount in RedHen CRM 8

Returns the number of connections to this entity.

Parameters

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

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

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

Return value

int The number of Connection entities connected to this entity.

Overrides ConnectionServiceInterface::getConnectionCount

File

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

Class

ConnectionService
Provides an interface for getting connections between entities.

Namespace

Drupal\redhen_connection

Code

public function getConnectionCount(EntityInterface $entity, EntityInterface $entity2 = NULL, $connection_type = NULL) {
  $connections = $this
    ->connectionQuery($entity, $entity2, $connection_type);
  return count($connections);
}