当前路径:vendor/topthink/framework/src/think/contract/ModelRelationInterface.php <?php // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- // | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- // | Author: liu21st <liu21st@gmail.com> // +---------------------------------------------------------------------- declare (strict_types = 1); namespace think\contract; use Closure; use think\Collection; use think\db\Query; use think\Model; /** * 模型关联接口 */ interface ModelRelationInterface { /** * 延迟获取关联数据 * @access public * @param array $subRelation 子关联 * @param Closure $closure 闭包查询条件 * @return Collection */ public function getRelation(array $subRelation = [], Closure $closure = null): Collection; /** * 预载入关联查询 * @access public * @param array $resultSet 数据集 * @param string $relation 当前关联名 * @param array $subRelation 子关联名 * @param Closure $closure 闭包条件 * @return void */ public function eagerlyResultSet(array &$resultSet, string $relation, array $subRelation, Closure $closure = null): void; /** * 预载入关联查询 * @access public * @param Model $result 数据对象 * @param string $relation 当前关联名 * @param array $subRelation 子关联名 * @param Closure $closure 闭包条件 * @return void */ public function eagerlyResult(Model $result, string $relation, array $subRelation = [], Closure $closure = null): void; /** * 关联统计 * @access public * @param Model $result 模型对象 * @param Closure $closure 闭包 * @param string $aggregate 聚合查询方法 * @param string $field 字段 * @param string $name 统计字段别名 * @return integer */ public function relationCount(Model $result, Closure $closure, string $aggregate = 'count', string $field = '*', string &$name = null); /** * 创建关联统计子查询 * @access public * @param Closure $closure 闭包 * @param string $aggregate 聚合查询方法 * @param string $field 字段 * @param string $name 统计字段别名 * @return string */ public function getRelationCountQuery(Closure $closure = null, string $aggregate = 'count', string $field = '*', string &$name = null): string; /** * 根据关联条件查询当前模型 * @access public * @param string $operator 比较操作符 * @param integer $count 个数 * @param string $id 关联表的统计字段 * @param string $joinType JOIN类型 * @return Query */ public function has(string $operator = '>=', int $count = 1, string $id = '*', string $joinType = 'INNER'): Query; /** * 根据关联条件查询当前模型 * @access public * @param mixed $where 查询条件(数组或者闭包) * @param mixed $fields 字段 * @param string $joinType JOIN类型 * @return Query */ public function hasWhere($where = [], $fields = null, string $joinType = ''): Query; }
相关源码
- 可旋转的彩色立方体C#源代码2021-10-29
- 在线考试系统2021-10-15
- EduSoho开源网校系统源码2019-06-27
- 仿拼多多小程序商城源码2019-06-06
- PHP5网站运行监测系统源码2017-04-14
关于我们 | 顾问团队 | 发展历程 | 联系我们 | 源码上传
联系电话(Tel):4008-010-151(免长途)
地址:北京市海淀区大恒科技大厦五层 邮编:100080
Floor 5th,Daheng Building,Zhongguancun,Beijing,China,100080
51Aspx.com 版权所有 CopyRight © 2006-2023. 京ICP备09089570号 | 京公网安备11010702000869号
联系电话(Tel):4008-010-151(免长途)
地址:北京市海淀区大恒科技大厦五层 邮编:100080
Floor 5th,Daheng Building,Zhongguancun,Beijing,China,100080
51Aspx.com 版权所有 CopyRight © 2006-2023. 京ICP备09089570号 | 京公网安备11010702000869号