From 36965226acd25178ce3d28633aadc1749f85b9f2 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Sun, 1 Apr 2018 17:06:20 +0200 Subject: 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). --- admin/post/search.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'admin/post') diff --git a/admin/post/search.php b/admin/post/search.php index c2c83ca..ac472f8 100644 --- a/admin/post/search.php +++ b/admin/post/search.php @@ -14,17 +14,15 @@ require '../../core/application.php'; # IF: Handle search request #=============================================================================== if($search = HTTP::GET('q')) { - if($postIDs = Post\Item::getSearchResultIDs($search, [NULL, NULL, NULL], $Database)) { - foreach($postIDs as $postID) { - try { - $Post = Post\Factory::build($postID); - $User = User\Factory::build($Post->attr('user')); + foreach(Post\Item::getSearchResults($search, [NULL, NULL, NULL], $Database) as $Attribute) { + try { + $Post = Post\Factory::buildByAttribute($Attribute); + $User = User\Factory::build($Post->attr('user')); - $posts[] = generatePostItemTemplate($Post, $User); - } - catch(Post\Exception $Exception){} - catch(User\Exception $Exception){} + $posts[] = generatePostItemTemplate($Post, $User); } + catch(Post\Exception $Exception){} + catch(User\Exception $Exception){} } } -- cgit v1.2.3