Newer
Older
<?php
/**
* @file
* Contains \Drupal\node\NodeStorage.
*/
namespace Drupal\node;
catch
committed
use Drupal\Core\Entity\Sql\SqlContentEntityStorage;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Language\LanguageInterface;
/**
* Defines the controller class for nodes.
*
* This extends the base storage class, adding required special handling for
* node entities.
*/
catch
committed
class NodeStorage extends SqlContentEntityStorage implements NodeStorageInterface {
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**
* {@inheritdoc}
*/
public function revisionIds(NodeInterface $node) {
return $this->database->query(
'SELECT vid FROM {node_revision} WHERE nid=:nid ORDER BY vid',
array(':nid' => $node->id())
)->fetchCol();
}
/**
* {@inheritdoc}
*/
public function userRevisionIds(AccountInterface $account) {
return $this->database->query(
'SELECT vid FROM {node_field_revision} WHERE uid = :uid ORDER BY vid',
array(':uid' => $account->id())
)->fetchCol();
}
/**
* {@inheritdoc}
*/
public function updateType($old_type, $new_type) {
return $this->database->update('node')
->fields(array('type' => $new_type))
->condition('type', $old_type)
->execute();
}
/**
* {@inheritdoc}
*/
public function clearRevisionsLanguage($language) {
return $this->database->update('node_revision')
->fields(array('langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED))
->condition('langcode', $language->id)
->execute();
}