protected function EntityProcessorBase::existingEntityId in Feeds 8.3
Returns an existing entity id.
Parameters
\Drupal\feeds\FeedInterface $feed: The feed being processed.
\Drupal\feeds\Feeds\Item\ItemInterface $item: The item to find existing ids for.
Return value
int|string|null The ID of the entity, or null if not found.
1 call to EntityProcessorBase::existingEntityId()
- EntityProcessorBase::process in src/
Feeds/ Processor/ EntityProcessorBase.php - Processes the results from a parser.
File
- src/
Feeds/ Processor/ EntityProcessorBase.php, line 867
Class
- EntityProcessorBase
- Defines a base entity processor.
Namespace
Drupal\feeds\Feeds\ProcessorCode
protected function existingEntityId(FeedInterface $feed, ItemInterface $item) {
foreach ($this->feedType
->getMappings() as $delta => $mapping) {
if (empty($mapping['unique'])) {
continue;
}
foreach ($mapping['unique'] as $key => $true) {
$plugin = $this->feedType
->getTargetPlugin($delta);
$entity_id = $plugin
->getUniqueValue($feed, $mapping['target'], $key, $item
->get($mapping['map'][$key]));
if ($entity_id) {
return $entity_id;
}
}
}
}