Permalink
Browse files

move some tbl_pages logic out of navigation datasource and into PageM…

…anager
  • Loading branch information...
1 parent c164816 commit 6d5dfe458d27054cb1a914fc063afbcc5acef6dc @kanduvisla kanduvisla committed Mar 27, 2012
View
18 symphony/lib/toolkit/class.pagemanager.php
@@ -881,4 +881,22 @@ public static function resolvePageByPath($handle, $path = false)
return $row;
}
+
+ /**
+ * Fetch an associated array with Page ID's and the types they're using.
+ *
+ * @return array
+ * A 2-dimensional associated array where the key is the page ID.
+ */
+ public static function fetchPageTypeArray()
+ {
+ $types = Symphony::Database()->fetch("SELECT `page_id`,`type` FROM `tbl_pages_types`");
+ $page_types = array();
+ if(is_array($types)) {
+ foreach($types as $type) {
+ $page_types[$type['page_id']][] = $type['type'];
+ }
+ }
+ return $page_types;
+ }
}
View
8 symphony/lib/toolkit/data-sources/class.datasource.navigation.php
@@ -98,13 +98,7 @@ public function execute(&$param_pool) {
else {
// Build an array of all the types so that the page's don't have to do
// individual lookups.
- $types = Symphony::Database()->fetch("SELECT `page_id`,`type` FROM `tbl_pages_types`");
- $page_types = array();
- if(is_array($types)) {
- foreach($types as $type) {
- $page_types[$type['page_id']][] = $type['type'];
- }
- }
+ $page_types = PageManager::fetchPageTypeArray();
foreach($pages as $page) {
$result->appendChild($this->__buildPageXML($page, $page_types));

0 comments on commit 6d5dfe4

Please sign in to comment.