protected function FeedsProcessor::entityLoad in Feeds 8.2
Load an existing entity.
@todo We should be able to batch load these, if we found all of the existing ids first.
Parameters
$source: The feeds source that spawns this entity.
$entity_id: The unique id of the entity that should be loaded.
Return value
A new entity object.
3 calls to FeedsProcessor::entityLoad()
- FeedsNodeProcessor::entityLoad in lib/
Drupal/ feeds/ Plugin/ feeds/ processor/ FeedsNodeProcessor.php - Loads an existing node.
- FeedsProcessor::process in lib/
Drupal/ feeds/ Plugin/ FeedsProcessor.php - Process the result of the parsing stage.
- FeedsUserProcessor::entityLoad in lib/
Drupal/ feeds/ Plugin/ feeds/ processor/ FeedsUserProcessor.php - Loads an existing user.
2 methods override FeedsProcessor::entityLoad()
- FeedsNodeProcessor::entityLoad in lib/
Drupal/ feeds/ Plugin/ feeds/ processor/ FeedsNodeProcessor.php - Loads an existing node.
- FeedsUserProcessor::entityLoad in lib/
Drupal/ feeds/ Plugin/ feeds/ processor/ FeedsUserProcessor.php - Loads an existing user.
File
- lib/
Drupal/ feeds/ Plugin/ FeedsProcessor.php, line 101 - Contains FeedsProcessor and related classes.
Class
- FeedsProcessor
- Abstract class, defines interface for processors.
Namespace
Drupal\feeds\PluginCode
protected function entityLoad(FeedsSource $source, $entity_id) {
if ($this->config['update_existing'] == FEEDS_UPDATE_EXISTING) {
return entity_load($this
->entityType(), $entity_id);
}
$info = $this
->entityInfo();
$args = array(
':entity_id' => $entity_id,
);
$table = db_escape_table($info['base_table']);
$key = db_escape_field($info['entity_keys']['id']);
$values = db_query("SELECT * FROM {" . $table . "} WHERE {$key} = :entity_id", $args)
->fetchObject();
$entity = $this
->newEntity($source);
foreach ($values as $key => $value) {
$entity->{$key} = $value;
}
return $entity;
}