/** * Filters out already executed update functions by module. * * @param string $module * The module name. */ public function filterOutInvokedUpdatesByModule($module) { $existing_update_functions = $this->keyValue->get('existing_updates', []); $remaining_update_functions = array_filter($existing_update_functions, function ($function_name) use($module) { return strpos($function_name, "{$module}_{$this->updateType}_") !== 0; }); $this->keyValue->set('existing_updates', array_values($remaining_update_functions)); }
/** * {@inheritdoc} */ public function createFetchTask($project) { if (empty($this->fetchTasks)) { $this->fetchTasks = $this->fetchTaskStore->getAll(); } if (empty($this->fetchTasks[$project['name']])) { $this->fetchQueue->createItem($project); $this->fetchTaskStore->set($project['name'], $project); $this->fetchTasks[$project['name']] = REQUEST_TIME; } }
/** * {@inheritdoc} */ protected function doSave($id, EntityInterface $entity) { $is_new = $entity->isNew(); // Save the entity data in the key value store. $this->keyValueStore->set($entity->id(), $entity->toArray()); // If this is a rename, delete the original entity. if ($this->has($id, $entity) && $id !== $entity->id()) { $this->keyValueStore->delete($id); } return $is_new ? SAVED_NEW : SAVED_UPDATED; }
/** * {@inheritdoc} */ public function set($key, $value) { $this->cache[$key] = $value; $this->keyValueStore->set($key, $value); }
/** * Stores the entity type's field storage definitions in the application state. * * @param string $entity_type_id * The entity type identifier. * @param \Drupal\Core\Field\FieldStorageDefinitionInterface[] $storage_definitions * An array of field storage definitions. */ protected function setLastInstalledFieldStorageDefinitions($entity_type_id, array $storage_definitions) { $this->installedDefinitions->set($entity_type_id . '.field_storage_definitions', $storage_definitions); }