Refactor GetSubTreePaths method

Since the GetSubTreePaths method has been implemented in dbus_utility
and this commit is to integrate all the places where the
GetSubTreePaths method is called, and use the method in dbus_utility
uniformly.

Requires https://gerrit.openbmc.org/c/openbmc/sdbusplus/+/60020 to
build.

Tested: Redfish Validator Passed

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Ie4140d4484a7e4f4b943013f4371ffd2d44a22e9
diff --git a/redfish-core/lib/cable.hpp b/redfish-core/lib/cable.hpp
index 6bc7fba..3cb8c1d 100644
--- a/redfish-core/lib/cable.hpp
+++ b/redfish-core/lib/cable.hpp
@@ -1,11 +1,16 @@
 #pragma once
-#include <dbus_utility.hpp>
+
+#include "dbus_utility.hpp"
+
 #include <query.hpp>
 #include <sdbusplus/asio/property.hpp>
 #include <sdbusplus/unpack_properties.hpp>
 #include <utils/dbus_utils.hpp>
 #include <utils/json_utils.hpp>
 
+#include <array>
+#include <string_view>
+
 namespace redfish
 {
 /**
@@ -179,10 +184,10 @@
         asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/Cables";
         asyncResp->res.jsonValue["Name"] = "Cable Collection";
         asyncResp->res.jsonValue["Description"] = "Collection of Cable Entries";
-
+        constexpr std::array<std::string_view, 1> interfaces{
+            "xyz.openbmc_project.Inventory.Item.Cable"};
         collection_util::getCollectionMembers(
-            asyncResp, boost::urls::url("/redfish/v1/Cables"),
-            {"xyz.openbmc_project.Inventory.Item.Cable"});
+            asyncResp, boost::urls::url("/redfish/v1/Cables"), interfaces);
         });
 }