mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-11-30 02:37:58 +08:00
Fixed newModelBuilder not compatible with parent.
This commit is contained in:
parent
3a5a61f186
commit
83094d3cbb
@ -63,8 +63,8 @@ trait Cacheable
|
||||
|
||||
/**
|
||||
* Increment a column's value by a given amount.
|
||||
* @param mixed $column
|
||||
* @param mixed $amount
|
||||
* @param string $column
|
||||
* @param float|int $amount
|
||||
* @return int
|
||||
*/
|
||||
public function increment($column, $amount = 1, array $extra = [])
|
||||
@ -86,8 +86,8 @@ trait Cacheable
|
||||
|
||||
/**
|
||||
* Decrement a column's value by a given amount.
|
||||
* @param mixed $column
|
||||
* @param mixed $amount
|
||||
* @param string $column
|
||||
* @param float|int $amount
|
||||
* @return int
|
||||
*/
|
||||
public function decrement($column, $amount = 1, array $extra = [])
|
||||
@ -109,14 +109,15 @@ trait Cacheable
|
||||
|
||||
/**
|
||||
* Create a new Model query builder for the model.
|
||||
* @param QueryBuilder $query
|
||||
*/
|
||||
public function newModelBuilder(QueryBuilder $query): Builder
|
||||
public function newModelBuilder($query): Builder
|
||||
{
|
||||
if ($this->useCacheBuilder) {
|
||||
return new ModelCacheBuilder($query);
|
||||
}
|
||||
|
||||
return new Builder($query);
|
||||
return parent::newModelBuilder($query);
|
||||
}
|
||||
|
||||
public function newQuery(bool $cache = false): Builder
|
||||
|
@ -19,7 +19,7 @@ interface CacheableInterface
|
||||
{
|
||||
public static function findFromCache($id): ?Model;
|
||||
|
||||
public static function findManyFromCache($ids): Collection;
|
||||
public static function findManyFromCache(array $ids): Collection;
|
||||
|
||||
public function deleteCache(): bool;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user