class NodeStorage
Same name and namespace in other branches
- 11.x core/modules/node/src/NodeStorage.php \Drupal\node\NodeStorage
Defines the storage handler class for nodes.
This extends the base storage class, adding required special handling for node entities.
Hierarchy
- class \Drupal\Core\Entity\EntityHandlerBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait
- class \Drupal\Core\Entity\EntityStorageBase extends \Drupal\Core\Entity\EntityStorageInterface, \Drupal\Core\Entity\EntityHandlerInterface implements \Drupal\Core\Entity\EntityHandlerBase
- class \Drupal\Core\Entity\ContentEntityStorageBase extends \Drupal\Core\Entity\ContentEntityStorageInterface, \Drupal\Core\Entity\DynamicallyFieldableEntityStorageInterface, \Drupal\Core\Entity\BundleEntityStorageInterface implements \Drupal\Core\Entity\EntityStorageBase
- class \Drupal\Core\Entity\Sql\SqlContentEntityStorage extends \Drupal\Core\Entity\Sql\SqlEntityStorageInterface, \Drupal\Core\Entity\Schema\DynamicallyFieldableEntityStorageSchemaInterface, \Drupal\Core\Entity\EntityBundleListenerInterface implements \Drupal\Core\Entity\ContentEntityStorageBase
- class \Drupal\node\NodeStorage extends \Drupal\node\NodeStorageInterface implements \Drupal\Core\Entity\Sql\SqlContentEntityStorage
- class \Drupal\Core\Entity\Sql\SqlContentEntityStorage extends \Drupal\Core\Entity\Sql\SqlEntityStorageInterface, \Drupal\Core\Entity\Schema\DynamicallyFieldableEntityStorageSchemaInterface, \Drupal\Core\Entity\EntityBundleListenerInterface implements \Drupal\Core\Entity\ContentEntityStorageBase
- class \Drupal\Core\Entity\ContentEntityStorageBase extends \Drupal\Core\Entity\ContentEntityStorageInterface, \Drupal\Core\Entity\DynamicallyFieldableEntityStorageInterface, \Drupal\Core\Entity\BundleEntityStorageInterface implements \Drupal\Core\Entity\EntityStorageBase
- class \Drupal\Core\Entity\EntityStorageBase extends \Drupal\Core\Entity\EntityStorageInterface, \Drupal\Core\Entity\EntityHandlerInterface implements \Drupal\Core\Entity\EntityHandlerBase
Expanded class hierarchy of NodeStorage
File
-
core/
modules/ node/ src/ NodeStorage.php, line 15
Namespace
Drupal\nodeView source
class NodeStorage extends SqlContentEntityStorage implements NodeStorageInterface {
/**
* {@inheritdoc}
*/
public function revisionIds(NodeInterface $node) {
return $this->database
->query('SELECT [vid] FROM {' . $this->getRevisionTable() . '} WHERE [nid] = :nid ORDER BY [vid]', [
':nid' => $node->id(),
])
->fetchCol();
}
/**
* {@inheritdoc}
*/
public function userRevisionIds(AccountInterface $account) {
return $this->database
->query('SELECT [vid] FROM {' . $this->getRevisionDataTable() . '} WHERE [uid] = :uid ORDER BY [vid]', [
':uid' => $account->id(),
])
->fetchCol();
}
/**
* {@inheritdoc}
*/
public function countDefaultLanguageRevisions(NodeInterface $node) {
return $this->database
->query('SELECT COUNT(*) FROM {' . $this->getRevisionDataTable() . '} WHERE [nid] = :nid AND [default_langcode] = 1', [
':nid' => $node->id(),
])
->fetchField();
}
/**
* {@inheritdoc}
*/
public function updateType($old_type, $new_type) {
return $this->database
->update($this->getBaseTable())
->fields([
'type' => $new_type,
])
->condition('type', $old_type)
->execute();
}
/**
* {@inheritdoc}
*/
public function clearRevisionsLanguage(LanguageInterface $language) {
return $this->database
->update($this->getRevisionTable())
->fields([
'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
])
->condition('langcode', $language->getId())
->execute();
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.