You are here

public function LinkCheckerStorage::getExistingIdsFromLink in Link checker 8

Get existing IDs that matches the URL and entity.

Parameters

\Drupal\linkchecker\Entity\LinkCheckerLink $link: The link.

Return value

array An array of IDs, or an empty array if not found.

File

src/LinkCheckerStorage.php, line 22

Class

LinkCheckerStorage
The storage for link checker.

Namespace

Drupal\linkchecker

Code

public function getExistingIdsFromLink(LinkCheckerLink $link) {
  $query = $this
    ->getQuery();
  $query
    ->condition('urlhash', LinkCheckerLink::generateHash($link
    ->getUrl()))
    ->condition('entity_id.target_id', $link
    ->getParentEntity()
    ->id())
    ->condition('entity_id.target_type', $link
    ->getParentEntity()
    ->getEntityTypeId())
    ->condition('entity_field', $link
    ->getParentEntityFieldName())
    ->condition('entity_langcode', $link
    ->getParentEntityLangcode());
  return $query
    ->execute();
}