You are here

protected function EntityProcessorBase::hash in Feeds 8.3

Creates an MD5 hash of an item.

Includes mappings so that items will be updated if the mapping configuration has changed.

Parameters

\Drupal\feeds\Feeds\Item\ItemInterface $item: The item to hash.

Return value

string An MD5 hash.

1 call to EntityProcessorBase::hash()
EntityProcessorBase::process in src/Feeds/Processor/EntityProcessorBase.php
Processes the results from a parser.

File

src/Feeds/Processor/EntityProcessorBase.php, line 1014

Class

EntityProcessorBase
Defines a base entity processor.

Namespace

Drupal\feeds\Feeds\Processor

Code

protected function hash(ItemInterface $item) {
  $sources = $this->feedType
    ->getMappedSources();
  $mapped_item = array_intersect_key($item
    ->toArray(), $sources);
  return hash('md5', serialize($mapped_item) . serialize($this->feedType
    ->getMappings()));
}