mirror of
https://github.com/friendica/friendica
synced 2025-04-21 13:50:11 +00:00
Add common relationship methods to Model\ContactRelation
- Introduce DBA::mergeConditions method - Replace GContact relationship method contents with Model\ContactRelation method calls
This commit is contained in:
parent
a6a23802b7
commit
24a82110fd
5 changed files with 425 additions and 117 deletions
|
@ -109,26 +109,22 @@ abstract class BaseRepository extends BaseFactory
|
|||
*/
|
||||
public function selectByBoundaries(array $condition = [], array $params = [], int $max_id = null, int $since_id = null, int $limit = self::LIMIT)
|
||||
{
|
||||
$condition = DBA::collapseCondition($condition);
|
||||
$totalCount = DBA::count(static::$table_name, $condition);
|
||||
|
||||
$boundCondition = $condition;
|
||||
|
||||
if (isset($max_id)) {
|
||||
$boundCondition[0] .= " AND `id` < ?";
|
||||
$boundCondition[] = $max_id;
|
||||
$boundCondition = DBA::mergeConditions($boundCondition, ['`id` < ?', $max_id]);
|
||||
}
|
||||
|
||||
if (isset($since_id)) {
|
||||
$boundCondition[0] .= " AND `id` > ?";
|
||||
$boundCondition[] = $since_id;
|
||||
$boundCondition = DBA::mergeConditions($boundCondition, ['`id` > ?', $since_id]);
|
||||
}
|
||||
|
||||
$params['limit'] = $limit;
|
||||
|
||||
$models = $this->selectModels($boundCondition, $params);
|
||||
|
||||
$totalCount = DBA::count(static::$table_name, $condition);
|
||||
|
||||
return new static::$collection_class($models, $totalCount);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue