Revert Repo::select()/selectFirst() changes
This commit is contained in:
parent
a77c78522c
commit
82f37ccdaf
|
@ -63,15 +63,13 @@ abstract class BaseRepository extends BaseFactory
|
||||||
* Chainable.
|
* Chainable.
|
||||||
*
|
*
|
||||||
* @param array $condition
|
* @param array $condition
|
||||||
* @param array $order An optional array with order information
|
* @param array $params
|
||||||
* @param int|array $limit Optional limit information
|
|
||||||
*
|
|
||||||
* @return BaseCollection
|
* @return BaseCollection
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function select(array $condition = [], array $order = [], $limit = null)
|
public function select(array $condition = [], array $params = [])
|
||||||
{
|
{
|
||||||
$models = $this->selectModels($condition, $order, $limit);
|
$models = $this->selectModels($condition, $params);
|
||||||
|
|
||||||
return new static::$collection_class($models);
|
return new static::$collection_class($models);
|
||||||
}
|
}
|
||||||
|
@ -83,15 +81,14 @@ abstract class BaseRepository extends BaseFactory
|
||||||
* Chainable.
|
* Chainable.
|
||||||
*
|
*
|
||||||
* @param array $condition
|
* @param array $condition
|
||||||
* @param array $order
|
* @param array $params
|
||||||
* @param int? $max_id
|
* @param int? $max_id
|
||||||
* @param int? $since_id
|
* @param int? $since_id
|
||||||
* @param int $limit
|
* @param int $limit
|
||||||
*
|
|
||||||
* @return BaseCollection
|
* @return BaseCollection
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function selectByBoundaries(array $condition = [], array $order = [], int $max_id = null, int $since_id = null, int $limit = self::LIMIT)
|
public function selectByBoundaries(array $condition = [], array $params = [], int $max_id = null, int $since_id = null, int $limit = self::LIMIT)
|
||||||
{
|
{
|
||||||
$condition = DBA::collapseCondition($condition);
|
$condition = DBA::collapseCondition($condition);
|
||||||
|
|
||||||
|
@ -107,7 +104,9 @@ abstract class BaseRepository extends BaseFactory
|
||||||
$boundCondition[] = $since_id;
|
$boundCondition[] = $since_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
$models = $this->selectModels($boundCondition, $order, $limit);
|
$params['limit'] = $limit;
|
||||||
|
|
||||||
|
$models = $this->selectModels($boundCondition, $params);
|
||||||
|
|
||||||
$totalCount = DBA::count(static::$table_name, $condition);
|
$totalCount = DBA::count(static::$table_name, $condition);
|
||||||
|
|
||||||
|
@ -176,24 +175,12 @@ abstract class BaseRepository extends BaseFactory
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $condition Query condition
|
* @param array $condition Query condition
|
||||||
* @param array $order An optional array with order information
|
* @param array $params Additional query parameters
|
||||||
* @param int|array $limit Optional limit information
|
|
||||||
*
|
|
||||||
* @return BaseModel[]
|
* @return BaseModel[]
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
protected function selectModels(array $condition, array $order = [], $limit = null)
|
protected function selectModels(array $condition, array $params = [])
|
||||||
{
|
{
|
||||||
$params = [];
|
|
||||||
|
|
||||||
if (!empty($order)) {
|
|
||||||
$params['order'] = $order;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($limit)) {
|
|
||||||
$params['limit'] = $limit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = $this->dba->select(static::$table_name, [], $condition, $params);
|
$result = $this->dba->select(static::$table_name, [], $condition, $params);
|
||||||
|
|
||||||
/** @var BaseModel $prototype */
|
/** @var BaseModel $prototype */
|
||||||
|
|
|
@ -35,28 +35,26 @@ class Introduction extends BaseRepository
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $condition
|
* @param array $condition
|
||||||
* @param array $order An optional array with order information
|
* @param array $params
|
||||||
* @param int|array $limit Optional limit information
|
|
||||||
*
|
|
||||||
* @return Collection\Introductions
|
* @return Collection\Introductions
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function select(array $condition = [], array $order = [], $limit = null)
|
public function select(array $condition = [], array $params = [])
|
||||||
{
|
{
|
||||||
return parent::select($condition, $order, $limit);
|
return parent::select($condition, $params);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $condition
|
* @param array $condition
|
||||||
* @param array $order
|
* @param array $params
|
||||||
* @param int|null $max_id
|
* @param int|null $max_id
|
||||||
* @param int|null $since_id
|
* @param int|null $since_id
|
||||||
* @param int|array $limit
|
* @param int $limit
|
||||||
* @return Collection\Introductions
|
* @return Collection\Introductions
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function selectByBoundaries(array $condition = [], array $order = [], int $max_id = null, int $since_id = null, int $limit = self::LIMIT)
|
public function selectByBoundaries(array $condition = [], array $params = [], int $max_id = null, int $since_id = null, int $limit = self::LIMIT)
|
||||||
{
|
{
|
||||||
return parent::selectByBoundaries($condition, $order, $max_id, $since_id, $limit);
|
return parent::selectByBoundaries($condition, $params, $max_id, $since_id, $limit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,29 +61,27 @@ class PermissionSet extends BaseRepository
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $condition
|
* @param array $condition
|
||||||
* @param array $order An optional array with order information
|
* @param array $params
|
||||||
* @param int|array $limit Optional limit information
|
|
||||||
*
|
|
||||||
* @return Collection\PermissionSets
|
* @return Collection\PermissionSets
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function select(array $condition = [], array $order = [], $limit = null)
|
public function select(array $condition = [], array $params = [])
|
||||||
{
|
{
|
||||||
return parent::select($condition, $order, $limit);
|
return parent::select($condition, $params);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $condition
|
* @param array $condition
|
||||||
* @param array $order
|
* @param array $params
|
||||||
* @param int|null $max_id
|
* @param int|null $max_id
|
||||||
* @param int|null $since_id
|
* @param int|null $since_id
|
||||||
* @param int|array $limit
|
* @param int $limit
|
||||||
* @return Collection\PermissionSets
|
* @return Collection\PermissionSets
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function selectByBoundaries(array $condition = [], array $order = [], int $max_id = null, int $since_id = null, int $limit = self::LIMIT)
|
public function selectByBoundaries(array $condition = [], array $params = [], int $max_id = null, int $since_id = null, int $limit = self::LIMIT)
|
||||||
{
|
{
|
||||||
return parent::selectByBoundaries($condition, $order, $max_id, $since_id, $limit);
|
return parent::selectByBoundaries($condition, $params, $max_id, $since_id, $limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user