You are here

public function SynonymsFindProviderInterface::synonymsFind in Synonyms 8

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 SynonymsFindTrait 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 SynonymsFindProviderInterface::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/SynonymsProviderInterface/SynonymsFindProviderInterface.php, line 56

Class

SynonymsFindProviderInterface
Interface to look up entities by synonyms they have.

Namespace

Drupal\synonyms\SynonymsProviderInterface

Code

public function synonymsFind(ConditionInterface $condition);