public function InvalidationsService::getFromQueueData in Purge 8.3
Replicate a invalidation object from serialized queue item data.
Parameters
string $item_data: Arbitrary PHP data structured that was stored into the queue.
Return value
\Drupal\purge\Plugin\Purge\Invalidation\InvalidationInterface The invalidation object.
Throws
\Drupal\purge\Plugin\Purge\Invalidation\Exception\MissingExpressionException Thrown when plugin defined expression_required = TRUE and when it is instantiated without expression (NULL).
\Drupal\purge\Plugin\Purge\Invalidation\Exception\InvalidExpressionException Exception thrown when plugin got instantiated with an expression that is not deemed valid for the type of invalidation.
Overrides InvalidationsServiceInterface::getFromQueueData
File
- src/
Plugin/ Purge/ Invalidation/ InvalidationsService.php, line 101
Class
- InvalidationsService
- Provides a service that instantiates invalidation objects on-demand.
Namespace
Drupal\purge\Plugin\Purge\InvalidationCode
public function getFromQueueData($item_data) {
$instance = $this
->createInstance($item_data[ProxyItemInterface::DATA_INDEX_TYPE], $item_data[ProxyItemInterface::DATA_INDEX_EXPRESSION], $this->instanceCounter++);
// Replay stored purger states.
if (isset($item_data[ProxyItemInterface::DATA_INDEX_STATES])) {
foreach ($item_data[ProxyItemInterface::DATA_INDEX_STATES] as $id => $state) {
$instance
->setStateContext($id);
$instance
->setState($state);
}
$instance
->setStateContext(NULL);
}
// Replay stored properties.
if (isset($item_data[ProxyItemInterface::DATA_INDEX_PROPERTIES])) {
foreach ($item_data[ProxyItemInterface::DATA_INDEX_PROPERTIES] as $id => $properties) {
$instance
->setStateContext($id);
foreach ($properties as $key => $value) {
$instance
->setProperty($key, $value);
}
}
$instance
->setStateContext(NULL);
}
return $instance;
}