summaryrefslogtreecommitdiffstats
path: root/core/modules/node/src/Entity/Node.php
diff options
context:
space:
mode:
authorNathaniel Catchpole2015-07-03 14:40:43 +0100
committerNathaniel Catchpole2015-07-03 14:40:43 +0100
commita47cadae5e94dbb0545a666d173e5bc9227a0f47 (patch)
tree59494960d22a093b07059eac230e269c5ceacf11 /core/modules/node/src/Entity/Node.php
parent9907029cdb30ccc691832865658288af1cfdd25d (diff)
Issue #2498919 by stefan.r, Berdir, catch: Node::isPublished() and Node::getOwnerId() are expensive
Diffstat (limited to 'core/modules/node/src/Entity/Node.php')
-rw-r--r--core/modules/node/src/Entity/Node.php15
1 files changed, 12 insertions, 3 deletions
diff --git a/core/modules/node/src/Entity/Node.php b/core/modules/node/src/Entity/Node.php
index 2f57843..afa31e3 100644
--- a/core/modules/node/src/Entity/Node.php
+++ b/core/modules/node/src/Entity/Node.php
@@ -53,7 +53,9 @@ use Drupal\user\UserInterface;
* "bundle" = "type",
* "label" = "title",
* "langcode" = "langcode",
- * "uuid" = "uuid"
+ * "uuid" = "uuid",
+ * "status" = "status",
+ * "uid" = "uid",
* },
* bundle_entity_type = "node_type",
* field_ui_base_route = "entity.node_type.edit_form",
@@ -73,6 +75,13 @@ class Node extends ContentEntityBase implements NodeInterface {
use EntityChangedTrait;
/**
+ * Whether the node is being previewed or not.
+ *
+ * @var true|null
+ */
+ public $in_preview = NULL;
+
+ /**
* {@inheritdoc}
*/
public function preSave(EntityStorageInterface $storage) {
@@ -258,7 +267,7 @@ class Node extends ContentEntityBase implements NodeInterface {
* {@inheritdoc}
*/
public function isPublished() {
- return (bool) $this->get('status')->value;
+ return (bool) $this->getEntityKey('status');
}
/**
@@ -280,7 +289,7 @@ class Node extends ContentEntityBase implements NodeInterface {
* {@inheritdoc}
*/
public function getOwnerId() {
- return $this->get('uid')->target_id;
+ return $this->getEntityKey('uid');
}
/**