diff --git a/core/modules/views/src/Plugin/views/cache/CachePluginBase.php b/core/modules/views/src/Plugin/views/cache/CachePluginBase.php index 673ed08..163dc44 100644 --- a/core/modules/views/src/Plugin/views/cache/CachePluginBase.php +++ b/core/modules/views/src/Plugin/views/cache/CachePluginBase.php @@ -358,7 +358,7 @@ protected function prepareViewResult(array $result) { // original result rows intact. foreach ($result as $key => $row) { $clone = clone $row; - unset($clone->_entity, $clone->_relationship_entities); + $clone->resetEntityData(); $return[$key] = $clone; } diff --git a/core/modules/views/src/ResultRow.php b/core/modules/views/src/ResultRow.php index a74ed91..d93d056 100644 --- a/core/modules/views/src/ResultRow.php +++ b/core/modules/views/src/ResultRow.php @@ -24,7 +24,7 @@ class ResultRow { * * @var \Drupal\Core\Entity\EntityInterface[] */ - public $_relationship_entities = array(); + public $_relationship_entities = []; /** * An incremental number which represents the row in the entire result. @@ -45,4 +45,12 @@ public function __construct(array $values = array()) { } } + /** + * Resets the _entity and _relationship_entities properties. + */ + public function resetEntityData() { + $this->_entity = NULL; + $this->_relationship_entities = []; + } + }