From 6e1be6099ff556b5207619d02e31fe95fb4d89c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Burnichon?= Date: Fri, 26 Feb 2016 13:07:55 +0100 Subject: [PATCH] Avoid cache requests on subdef already in cache. --- lib/classes/record/adapter.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/classes/record/adapter.php b/lib/classes/record/adapter.php index d7113ac631..0119b13db2 100644 --- a/lib/classes/record/adapter.php +++ b/lib/classes/record/adapter.php @@ -565,14 +565,14 @@ class record_adapter implements RecordInterface, cache_cacheableInterface { $name = strtolower($name); - if (!in_array($name, $this->get_available_subdefs())) { - throw new Exception_Media_SubdefNotFound(sprintf("subdef `%s` not found", $name)); - } - if (isset($this->subdefs[$name])) { return $this->subdefs[$name]; } + if (!in_array($name, $this->get_available_subdefs())) { + throw new Exception_Media_SubdefNotFound(sprintf("subdef `%s` not found", $name)); + } + if (!$this->subdefs) { $this->subdefs = []; } @@ -1583,7 +1583,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface } /** - * @return set_selection + * @return set_selection|record_adapter[] * @throws Exception * @throws \Doctrine\DBAL\DBALException * @deprecated use {@link self::getChildren} instead. @@ -1593,6 +1593,11 @@ class record_adapter implements RecordInterface, cache_cacheableInterface return $this->getChildren(); } + /** + * @return set_selection|record_adapter[] + * @throws Exception + * @throws \Doctrine\DBAL\DBALException + */ public function getChildren() { if (!$this->isStory()) {