gitlilimin

Results 6 issues of gitlilimin

在单应用模式下(多应用模式未测试,从源码看同样存在),使用命令行指令`php think optimize:schema`进行模型字段缓存生成时,如果 app/model 目录下还存在子目录,会抛出异常。 #### 复现方式 (单应用模式),在app/model目录中存在任意子目录 --app ----model ------common --------BaseModel.php ------User.php ------Article.php #### 问题分析 问题所在的Schema.php类中大致流程如下 1. 获取所有app/model中的文件及目录 2. (问题所在)遍历文件和目录,将其名称作为类名传给 buildModelSchema() 进行解析 3. new \ReflectionClass() 实例化反射类 4. 判断反射类是否是抽象类、是否继承 think\Model...

### 多态关联中当多态类型未定义时,查询会抛出异常,且异常内容不明确,不便于用户获知问题所在。 ### 问题场景 如下三张表: ``` article id - integer title - string content - text book id - integer title - string comment id - integer content - text...

【简述】 A、B两个模型一对多关联,直接访问B->A->Bs时,得到的结果不符合预期 【环境】 [MySQL] 表 User ,通过 team_id 关联一个 Team 表 Team [model] 模型 User,定义关联:Team -> belongTo(Team::class, 'team_id', 'id') 模型 Team,定义关联:Users -> hasMany(User::class, 'team_id, 'id') 【复现场景】 [controller] $user = User::find(1);...

source: ```html th1 th2 {volist name="saixiang_list" id="item"} {if $item.is_checked}√{/if} {$item.table_html|raw} {/volist} ``` useage: ``` const $ = cheerio.load(htmlContent) console.log($.html()) ``` output: ``` {volist name="saixiang_list" id="item"} {$item.table_html|raw} {/volist} th1 th2 {if...

Model类的__clone()方法中抛出了未引用的InvalidArgumentException类,一般情况不会报错,但在极端情况下访问__clone()方法时会抛出意料之外的错误

原本实体模型的 __callStatic() 中是写死了对应模型的几个方法,只有这些方法支持对实体模型对应的模型调用,代码如下 ``` public static function __callStatic($method, $args) { $entity = new static(); if (in_array($method, ['destroy', 'create', 'update', 'saveAll'])) { // 调用model的静态方法 $db = $entity->model(); } else { //...