You are here

public function CorrespondingReferenceStorage::loadValid in Corresponding Entity References 8.4

Loads the valid corresponding reference config entities for the given entity.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity.

Return value

\Drupal\cer\Entity\CorrespondingReferenceInterface[] The valid corresponding references.

Overrides CorrespondingReferenceStorageInterface::loadValid

File

src/CorrespondingReferenceStorage.php, line 16

Class

CorrespondingReferenceStorage
Defines the Corresponding Reference storage.

Namespace

Drupal\cer

Code

public function loadValid(EntityInterface $entity) {
  $query = $this
    ->getQuery()
    ->condition('enabled', 1);
  $result = $query
    ->execute();
  if (empty($result)) {
    return [];
  }
  return $this
    ->loadMultiple($result);
}