protected function EntityReference::findEntities in Feeds 8.3
Tries to lookup an existing entity.
Parameters
string $field: The subfield to search in.
string|int $search: The value to lookup.
Return value
int[] A list of entity ID's.
2 calls to EntityReference::findEntities()
- EntityReference::findEntity in src/
Feeds/ Target/ EntityReference.php - Searches for an entity by entity key.
- EntityReference::prepareValue in src/
Feeds/ Target/ EntityReference.php - Prepares a single value.
File
- src/
Feeds/ Target/ EntityReference.php, line 310
Class
- EntityReference
- Defines an entity reference mapper.
Namespace
Drupal\feeds\Feeds\TargetCode
protected function findEntities(string $field, $search) {
if ($field == 'feeds_item') {
$field = 'feeds_item.' . $this->configuration['feeds_item'];
}
$target_ids = $this->entityFinder
->findEntities($this
->getEntityType(), $field, $search, $this
->getBundles());
if (!empty($target_ids)) {
return $target_ids;
}
if ($this->configuration['autocreate'] && $field === $this
->getLabelKey()) {
return [
$this
->createEntity($search),
];
}
return [];
}