You are here

public function FlowControllerSimple::updateEntityTypeVersions in CMS Content Sync 2.1.x

Cache the current version per entity type.

Return value

void

Overrides IFlowController::updateEntityTypeVersions

File

src/Controller/FlowControllerSimple.php, line 572

Class

FlowControllerSimple

Namespace

Drupal\cms_content_sync\Controller

Code

public function updateEntityTypeVersions() {
  $status = \Drupal::state()
    ->get('cms_content_sync.flow_status_' . $this->flow->id);
  if (empty($status)) {
    $status = [];
  }
  $types = $this
    ->getEntityTypeConfig(null, null, false, true);
  $versions = [];
  foreach ($types as $entity_type_name => $bundles) {
    foreach ($bundles as $bundle_name => $config) {
      $versions[$entity_type_name][$bundle_name] = $config['version'];
    }
  }
  $status['entity_type_versions'] = $versions;
  \Drupal::state()
    ->set('cms_content_sync.flow_status_' . $this->flow->id, $status);
}