Last active
September 7, 2017 23:15
-
-
Save christopher-hopper/568005a4e13d2857d85f2577755e4b97 to your computer and use it in GitHub Desktop.
Reroll patch for 8.2.x https://www.drupal.org/node/2903942
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/core/modules/views/src/Plugin/views/cache/CachePluginBase.php b/core/modules/views/src/Plugin/views/cache/CachePluginBase.php | |
index 87465ca06f..377d36f84e 100644 | |
--- a/core/modules/views/src/Plugin/views/cache/CachePluginBase.php | |
+++ b/core/modules/views/src/Plugin/views/cache/CachePluginBase.php | |
@@ -4,6 +4,7 @@ | |
use Drupal\Core\Cache\Cache; | |
use Drupal\Core\Cache\CacheableMetadata; | |
+use Drupal\Core\Entity\EntityInterface; | |
use Drupal\views\Plugin\views\PluginBase; | |
use Drupal\Core\Database\Query\Select; | |
use Drupal\views\ResultRow; | |
@@ -303,7 +304,9 @@ public function getRowCacheTags(ResultRow $row) { | |
if (!empty($row->_relationship_entities)) { | |
foreach ($row->_relationship_entities as $entity) { | |
- $tags = Cache::mergeTags($tags, $entity->getCacheTags()); | |
+ if ($entity instanceof EntityInterface) { | |
+ $tags = Cache::mergeTags($tags, $entity->getCacheTags()); | |
+ } | |
} | |
} | |
diff --git a/core/modules/views/src/Plugin/views/query/Sql.php b/core/modules/views/src/Plugin/views/query/Sql.php | |
index cfe593cc2e..604fffc898 100644 | |
--- a/core/modules/views/src/Plugin/views/query/Sql.php | |
+++ b/core/modules/views/src/Plugin/views/query/Sql.php | |
@@ -5,6 +5,7 @@ | |
use Drupal\Component\Utility\NestedArray; | |
use Drupal\Core\Cache\Cache; | |
use Drupal\Core\Database\Database; | |
+use Drupal\Core\Entity\EntityInterface; | |
use Drupal\Core\Entity\EntityTypeManagerInterface; | |
use Drupal\Core\Form\FormStateInterface; | |
use Drupal\views\Plugin\views\display\DisplayPluginBase; | |
@@ -1646,11 +1647,13 @@ public function getCacheMaxAge() { | |
protected function getAllEntities() { | |
$entities = []; | |
foreach ($this->view->result as $row) { | |
- if ($row->_entity) { | |
+ if ($row->_entity instanceof EntityInterface) { | |
$entities[] = $row->_entity; | |
} | |
foreach ($row->_relationship_entities as $entity) { | |
- $entities[] = $entity; | |
+ if ($entity instanceof EntityInterface) { | |
+ $entities[] = $entity; | |
+ } | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment