From bca4fada9861f78df82d570a2d16ba0cc9866242 Mon Sep 17 00:00:00 2001 From: Karel Wintersky Date: Sat, 7 Nov 2020 14:04:38 +0300 Subject: [PATCH] 1.7.1 * [*] changed behaviour --- interfaces/SphinxToolkitFoolzInterface.php | 8 ++++++-- src/SphinxToolkit.php | 8 ++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/interfaces/SphinxToolkitFoolzInterface.php b/interfaces/SphinxToolkitFoolzInterface.php index ef01096..d96e5b2 100644 --- a/interfaces/SphinxToolkitFoolzInterface.php +++ b/interfaces/SphinxToolkitFoolzInterface.php @@ -3,6 +3,7 @@ namespace Arris\Toolkit; use Closure; +use Foolz\SphinxQL\Drivers\ConnectionInterface; use Foolz\SphinxQL\Drivers\ResultSetInterface; use Foolz\SphinxQL\Exception\ConnectionException; use Foolz\SphinxQL\Exception\DatabaseException; @@ -30,6 +31,8 @@ public static function init(string $sphinx_connection_host, string $sphinx_conne /** * Создает коннекшен и устанавливает параметры подключения: хост и порт + * + * @return ConnectionInterface */ public static function initConnection(); @@ -121,13 +124,14 @@ public static function rt_TruncateIndex(string $index_name, bool $is_reconfigure * @throws SphinxQLException */ public static function rt_RebuildAbstractIndex(PDO $pdo_connection, string $sql_source_table, string $sphinx_index, Closure $make_updateset_method, string $condition = ''); - + /** * Создает инстанс на основе сохраненного в классе коннекшена * + * @param ConnectionInterface $connection * @return SphinxQL */ - public static function getInstance(); + public static function getInstance($connection); /** * Возвращает META-информацию (после запроса) diff --git a/src/SphinxToolkit.php b/src/SphinxToolkit.php index 15c45a9..fe3bbc5 100644 --- a/src/SphinxToolkit.php +++ b/src/SphinxToolkit.php @@ -373,9 +373,9 @@ public static function initConnection() /** * @inheritDoc */ - public static function getInstance() + public static function getInstance($connection) { - return (new SphinxQL(self::$spql_connection)); + return (new SphinxQL($connection)); } /** @@ -384,7 +384,7 @@ public static function getInstance() public static function createInstance() { self::$spql_connection = self::initConnection(); - self::$spql_instance = self::getInstance(); + self::$spql_instance = self::getInstance(self::$spql_connection); return self::$spql_instance; } @@ -523,7 +523,7 @@ public static function rt_RebuildAbstractIndex(PDO $pdo_connection, string $sql_ public static function showMeta() { - (new Helper(self::$spql_connection))->showMeta()->execute()->fetchAllAssoc(); + return (new Helper(self::$spql_connection))->showMeta()->execute()->fetchAllAssoc(); } /**