On develop, the page https://example.com/scp/kb.php gives
Fatal error: Call to a member function sort() on array in /root_path/include/staff/faq-categories.inc.php on line 148
I use a workaround like this:
- $categories->sort(function($a) { return $a->getLocalName(); });
+ sort($categories);
but I don't think it is the better way
Here is the config:
+1
I also had this issue once i upgraded 1.9.12 -> 1.10 rc3.
I also tried a fresh install of 1.10 rc3, as well as a git install (as directed on github page)
@balojs i tried your suggestion, it had no effect.
@bastienho Your method works for me.
Hopefully this gets fixed on future versions.
thanks @zguithues check this path #3186 (84ebb88)
Could you also try this patch? I would like to use sorting in the ORM elsewhere and be consistent...
diff --git a/include/staff/faq-categories.inc.php b/include/staff/faq-categories.inc.php
index e90f06c..18ef634 100644
--- a/include/staff/faq-categories.inc.php
+++ b/include/staff/faq-categories.inc.php
@@ -141,7 +141,7 @@ if($_REQUEST['q'] || $_REQUEST['cid'] || $_REQUEST['topicId']) { //Search.
} else { //Category Listing.
$categories = Category::objects()
->annotate(array('faq_count'=>SqlAggregate::COUNT('faqs')))
- ->all();
+ ->getIterator();
if (count($categories)) {
$categories->sort(function($a) { return $a->getLocalName(); });
@greezybacon Confirmed that patch works.
I created #3216 to address the issue
Patch #3216 works for me @greezybacon
Thanks for the quick fix! :)
Most helpful comment
I created #3216 to address the issue