From 1321f57841917337e8d68fdaaf8a8a7b3f47f22b Mon Sep 17 00:00:00 2001 From: WebSee Date: Wed, 26 Dec 2012 20:32:05 +1100 Subject: [PATCH] Update core/components/wayfinder/wayfinder.class.php Optimization - remove document objects --- core/components/wayfinder/wayfinder.class.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/core/components/wayfinder/wayfinder.class.php b/core/components/wayfinder/wayfinder.class.php index 9aebbee..2587b96 100644 --- a/core/components/wayfinder/wayfinder.class.php +++ b/core/components/wayfinder/wayfinder.class.php @@ -593,7 +593,9 @@ public function getData() { 'protected' => 'ResourceGroupResources.document_group', )); - $result = $this->modx->getCollection('modResource', $c); + $c->prepare(); + $c->stmt->execute(); + $result = $c->stmt->fetchAll(PDO::FETCH_ASSOC); $resourceArray = array(); @@ -628,14 +630,15 @@ public function getData() { $switchedContext = false; /** @var modResource $doc */ foreach ($result as $doc) { - $docContextKey = $doc->get('context_key'); + $docContextKey = $doc['context_key']; if (!empty($docContextKey) && $docContextKey != $currentContext) { $this->modx->switchContext($docContextKey); $switchedContext = true; - $currentContext = $doc->get('context_key'); + $currentContext = $doc['context_key']; } - if ((!empty($this->_config['permissions'])) && (!$doc->checkPolicy($this->_config['permissions']))) continue; - $tempDocInfo = $doc->toArray(); + //TODO: find a solution for replacing $doc->checkPolicy($this->_config['permissions']) + //if ((!empty($this->_config['permissions'])) && (!$doc->checkPolicy($this->_config['permissions']))) continue; + $tempDocInfo = $doc; $resultIds[] = $tempDocInfo['id']; $tempDocInfo['content'] = $tempDocInfo['class_key'] == 'modWebLink' ? $tempDocInfo['content'] : ''; /* create the link */ @@ -930,4 +933,4 @@ public function modxPrep($value) { $value = str_replace("}","}",$value); return $value; } -} \ No newline at end of file +}