You are here

public function SynonymForm::exist in Synonyms 8

Same name and namespace in other branches
  1. 2.0.x src/Form/SynonymForm.php \Drupal\synonyms\Form\SynonymForm::exist()

Check whether entity with such ID already exists.

Parameters

string $id: Entity ID to check.

Return value

bool Whether entity with such ID already exists.

File

src/Form/SynonymForm.php, line 273

Class

SynonymForm
Entity form for 'synonym' config entity type.

Namespace

Drupal\synonyms\Form

Code

public function exist($id) {
  $entity = $this->entityTypeManager
    ->getStorage('synonym')
    ->getQuery()
    ->condition('id', $id)
    ->execute();
  return (bool) $entity;
}