diff options
author | Thomas Lange <code@nerdmind.de> | 2018-04-01 17:06:20 +0200 |
---|---|---|
committer | Thomas Lange <code@nerdmind.de> | 2018-04-01 17:06:20 +0200 |
commit | 36965226acd25178ce3d28633aadc1749f85b9f2 (patch) | |
tree | 55fccdaf919b18809f9143eac051185fe977cfc3 /admin/page | |
parent | 2a017afea40941f6cc18208a6f595ee129ae143c (diff) | |
download | blog-36965226acd25178ce3d28633aadc1749f85b9f2.tar.gz blog-36965226acd25178ce3d28633aadc1749f85b9f2.tar.xz blog-36965226acd25178ce3d28633aadc1749f85b9f2.zip |
Replace method calls "getSearchResultIDs" with "getSearchResults"
This commit replaces the method calls of "Item::getSearchResultIDs" with "Item::getSearchResults".
In addition, the associated Item instances (Page or Post) are therefore now created with "Factory::buildByAttribute" instead of "Factory::build" (because "getSearchResults" returns an array of Attribute instances while "getSearchResultIDs" had returned an array of unique item IDs without attribute data).
Diffstat (limited to 'admin/page')
-rw-r--r-- | admin/page/search.php | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/admin/page/search.php b/admin/page/search.php index d97370d..0506a0d 100644 --- a/admin/page/search.php +++ b/admin/page/search.php @@ -14,17 +14,15 @@ require '../../core/application.php'; # IF: Handle search request #=============================================================================== if($search = HTTP::GET('q')) { - if($pageIDs = Page\Item::getSearchResultIDs($search, $Database)) { - foreach($pageIDs as $pageID) { - try { - $Page = Page\Factory::build($pageID); - $User = User\Factory::build($Page->attr('user')); + foreach(Page\Item::getSearchResults($search, $Database) as $Attribute) { + try { + $Page = Page\Factory::buildByAttribute($Attribute); + $User = User\Factory::build($Page->attr('user')); - $pages[] = generatePageItemTemplate($Page, $User); - } - catch(Page\Exception $Exception){} - catch(User\Exception $Exception){} + $pages[] = generatePageItemTemplate($Page, $User); } + catch(Page\Exception $Exception){} + catch(User\Exception $Exception){} } } |