You are here

public function FindInterface::synonymsFind in Synonyms 2.0.x

Look up entities by their synonyms within a behavior implementation.

You are provided with a SQL condition that you should apply to the storage of synonyms within the provided behavior implementation. And then return result: what entities are matched by the provided condition through what synonyms.

Parameters

\Drupal\Core\Database\Query\ConditionInterface $condition: Condition that defines what to search for. Apart from normal SQL conditions as known in Drupal, it may contain the following placeholders:

For ease of work with these placeholders, you may use the FindTrait and then just invoke the $this->synonymsFindProcessCondition() method, so you won't have to worry much about it.

Return value

\Traversable Traversable result set of found synonyms and entity IDs to which those belong. Each element in the result set should be an object and should have the following structure:

  • synonym: (string) Synonym that was found and which satisfies the provided condition
  • entity_id: (int) ID of the entity to which the found synonym belongs
3 methods override FindInterface::synonymsFind()
BaseField::synonymsFind in src/Plugin/Synonyms/Provider/BaseField.php
Look up entities by their synonyms within a behavior implementation.
EntityReferenceField::synonymsFind in src/Plugin/Synonyms/Provider/EntityReferenceField.php
Look up entities by their synonyms within a behavior implementation.
Field::synonymsFind in src/Plugin/Synonyms/Provider/Field.php
Look up entities by their synonyms within a behavior implementation.

File

src/ProviderInterface/FindInterface.php, line 72

Class

FindInterface
Interface to look up entities by synonyms they have.

Namespace

Drupal\synonyms\ProviderInterface

Code

public function synonymsFind(ConditionInterface $condition);