* Returns a paginated list of contacts that are followed the provided public contact.
*
* @param int $cid Public contact id
+ * @param array $field Field list
* @param array $condition Additional condition on the contact table
* @param int $count
* @param int $offset
* @return array
* @throws Exception
*/
- public static function listFollows(int $cid, array $condition = [], int $count = 30, int $offset = 0, bool $shuffle = false)
+ public static function listFollows(int $cid, array $fields = [], 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`)',
$cid]
);
- return DI::dba()->selectToArray('contact', [], $condition,
+ return DI::dba()->selectToArray('contact', $fields, $condition,
['limit' => [$offset, $count], 'order' => [$shuffle ? 'RAND()' : 'name']]
);
}
* Returns a paginated list of contacts that follow the provided public contact.
*
* @param int $cid Public contact id
+ * @param array $field Field list
* @param array $condition Additional condition on the contact table
* @param int $count
* @param int $offset
* @return array
* @throws Exception
*/
- public static function listFollowers(int $cid, array $condition = [], int $count = 30, int $offset = 0, bool $shuffle = false)
+ public static function listFollowers(int $cid, array $fields = [], 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`)', $cid]
);
- $followers = DI::dba()->selectToArray('contact', [], $condition,
+ return DI::dba()->selectToArray('contact', $fields, $condition,
['limit' => [$offset, $count], 'order' => [$shuffle ? 'RAND()' : 'name']]
);
-
- return $followers;
}
/**
$sourceId, $targetId]
);
- $total = DI::dba()->count('contact', $condition);
-
- return $total;
+ return DI::dba()->count('contact', $condition);
}
/**
*
* @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
* @return array
* @throws Exception
*/
- public static function listCommon(int $sourceId, int $targetId, array $condition = [], int $count = 30, int $offset = 0, bool $shuffle = false)
+ public static function listCommon(int $sourceId, int $targetId, array $fields = [], 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`)
$sourceId, $targetId]
);
- $contacts = DI::dba()->selectToArray('contact', [], $condition,
+ return DI::dba()->selectToArray('contact', $fields, $condition,
['limit' => [$offset, $count], 'order' => [$shuffle ? 'name' : 'RAND()']]
);
-
- return $contacts;
}
$sourceId, $targetId]
);
- $total = DI::dba()->count('contact', $condition);
-
- return $total;
+ return DI::dba()->count('contact', $condition);
}
/**
*
* @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
* @return array
* @throws Exception
*/
- public static function listCommonFollows(int $sourceId, int $targetId, array $condition = [], int $count = 30, int $offset = 0, bool $shuffle = false)
+ public static function listCommonFollows(int $sourceId, int $targetId, array $fields = [], 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`)
$sourceId, $targetId]
);
- $contacts = DI::dba()->selectToArray('contact', [], $condition,
+ return DI::dba()->selectToArray('contact', $fields, $condition,
['limit' => [$offset, $count], 'order' => [$shuffle ? 'name' : 'RAND()']]
);
-
- return $contacts;
}
/**
*
* @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
* @return array
* @throws Exception
*/
- public static function listCommonFollowers(int $sourceId, int $targetId, array $condition = [], int $count = 30, int $offset = 0, bool $shuffle = false)
+ public static function listCommonFollowers(int $sourceId, int $targetId, array $fields = [], 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`)
$sourceId, $targetId]
);
- return DI::dba()->selectToArray('contact', [], $condition,
+ return DI::dba()->selectToArray('contact', $fields, $condition,
['limit' => [$offset, $count], 'order' => [$shuffle ? 'name' : 'RAND()']]
);
}