From ae23c69303c6eb766fe1c1bb3631aeda41248ea1 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Tue, 4 Aug 2020 22:44:18 -0400 Subject: [PATCH] Remove extraneous $field parameter in Contact\Relation methods --- src/Model/Contact/Relation.php | 14 ++++++-------- src/Model/GContact.php | 8 ++++---- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/Model/Contact/Relation.php b/src/Model/Contact/Relation.php index a5bd0e9b7..cc0570ec6 100644 --- a/src/Model/Contact/Relation.php +++ b/src/Model/Contact/Relation.php @@ -431,7 +431,7 @@ class Relation * @return array * @throws Exception */ - public static function listCommon(int $sourceId, int $targetId, array $fields = [], array $condition = [], int $count = 30, int $offset = 0, bool $shuffle = false) + public static function listCommon(int $sourceId, int $targetId, array $condition = [], int $count = 30, int $offset = 0, bool $shuffle = false) { $condition = DBA::mergeConditions($condition, ["`id` IN (SELECT `relation-cid` FROM `contact-relation` WHERE `cid` = ? AND `follows`) @@ -439,7 +439,7 @@ class Relation $sourceId, $targetId] ); - return DI::dba()->selectToArray('contact', $fields, $condition, + return DI::dba()->selectToArray('contact', [], $condition, ['limit' => [$offset, $count], 'order' => [$shuffle ? 'name' : 'RAND()']] ); } @@ -470,7 +470,6 @@ class Relation * * @param int $sourceId Public contact id * @param int $targetId Public contact id - * @param array $field Field list * @param array $condition Additional condition array on the contact table * @param int $count * @param int $offset @@ -478,7 +477,7 @@ class Relation * @return array * @throws Exception */ - public static function listCommonFollows(int $sourceId, int $targetId, array $fields = [], array $condition = [], int $count = 30, int $offset = 0, bool $shuffle = false) + public static function listCommonFollows(int $sourceId, int $targetId, array $condition = [], int $count = 30, int $offset = 0, bool $shuffle = false) { $condition = DBA::mergeConditions($condition, ["`id` IN (SELECT `relation-cid` FROM `contact-relation` WHERE `cid` = ? AND `follows`) @@ -486,7 +485,7 @@ class Relation $sourceId, $targetId] ); - return DI::dba()->selectToArray('contact', $fields, $condition, + return DI::dba()->selectToArray('contact', [], $condition, ['limit' => [$offset, $count], 'order' => [$shuffle ? 'name' : 'RAND()']] ); } @@ -516,7 +515,6 @@ class Relation * * @param int $sourceId Public contact id * @param int $targetId Public contact id - * @param array $field Field list * @param array $condition Additional condition on the contact table * @param int $count * @param int $offset @@ -524,7 +522,7 @@ class Relation * @return array * @throws Exception */ - public static function listCommonFollowers(int $sourceId, int $targetId, array $fields = [], array $condition = [], int $count = 30, int $offset = 0, bool $shuffle = false) + public static function listCommonFollowers(int $sourceId, int $targetId, array $condition = [], int $count = 30, int $offset = 0, bool $shuffle = false) { $condition = DBA::mergeConditions($condition, ["`id` IN (SELECT `cid` FROM `contact-relation` WHERE `relation-cid` = ? AND `follows`) @@ -532,7 +530,7 @@ class Relation $sourceId, $targetId] ); - return DI::dba()->selectToArray('contact', $fields, $condition, + return DI::dba()->selectToArray('contact', [], $condition, ['limit' => [$offset, $count], 'order' => [$shuffle ? 'name' : 'RAND()']] ); } diff --git a/src/Model/GContact.php b/src/Model/GContact.php index 097b43456..3fe123e15 100644 --- a/src/Model/GContact.php +++ b/src/Model/GContact.php @@ -46,7 +46,7 @@ class GContact $sourceId, ]; - return Contact\Relation::countCommonFollows($sourceId, $targetIds['public'] ?? 0, [], $condition); + return Contact\Relation::countCommonFollows($sourceId, $targetIds['public'] ?? 0, $condition); } /** @@ -74,7 +74,7 @@ LIMIT 1", $sourceId, ]; - return Contact\Relation::countCommonFollowers($sourceId, $targetPublicContact['id'] ?? 0, [], $condition); + return Contact\Relation::countCommonFollowers($sourceId, $targetPublicContact['id'] ?? 0, $condition); } /** @@ -100,7 +100,7 @@ LIMIT 1", $sourceId, ]; - return Contact\Relation::listCommonFollows($sourceId, $targetIds['public'] ?? 0, [], $condition, $limit, $start, $shuffle); + return Contact\Relation::listCommonFollows($sourceId, $targetIds['public'] ?? 0, $condition, $limit, $start, $shuffle); } /** @@ -134,6 +134,6 @@ LIMIT 1", $sourceId, ]; - return Contact\Relation::listCommonFollows($sourceId, $targetPublicContact['id'] ?? 0, [], $condition, $limit, $start, $shuffle); + return Contact\Relation::listCommonFollows($sourceId, $targetPublicContact['id'] ?? 0, $condition, $limit, $start, $shuffle); } }