You are here

public function SynonymForm::exist in Synonyms 2.0.x

Same name and namespace in other branches
  1. 8 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 229

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;
}