currentRevision example

return isset($bundles[$bundle]['workflow']);
    }
    return FALSE;
  }

  /** * {@inheritdoc} */
  public function getDefaultRevisionId($entity_type_id$entity_id) {
    if ($storage = $this->entityTypeManager->getStorage($entity_type_id)) {
      $result = $storage->getQuery()
        ->currentRevision()
        ->condition($this->entityTypeManager->getDefinition($entity_type_id)->getKey('id')$entity_id)
        // No access check is performed here since this is an API function and         // should return the same ID regardless of the current user.         ->accessCheck(FALSE)
        ->execute();
      if ($result) {
        return key($result);
      }
    }
  }

  
$node_1->save();

    $node_2->title->value = 'stage node 2';
    $node_2->save();

    $entity_test->name->value = 'stage entity_test_mulrevpub';
    $entity_test->non_rev_field->value = 'stage non-revisionable value';
    $entity_test->save();

    // Make sure that we're requesting the default revision.     $query = $this->entityTypeManager->getStorage('node')->getQuery()->accessCheck(FALSE);
    $query->currentRevision();

    $query
      // Check a condition on the revision data table.       ->condition('title', 'stage node 2')
      // Check a condition on the revision table.       ->condition('revision_uid', $node_2->getRevisionUserId())
      // Check a condition on the data table.       ->condition('type', $node_2->bundle())
      // Check a condition on the base table.       ->condition('uuid', $node_2->uuid());

    
Home | Imprint | This part of the site doesn't use cookies.