think-orm
think-orm copied to clipboard
Think ORM——the PHP Database&ORM Framework
直接调用或者查询字段,不支持数据库的查询事件,会支持吗? ``` $list_party_admin->column('party_id'); ```
hasWhere 报错,执行代码如下: ```php $list = Order::with(['orderGoods']) ->where('is_hdfk', '=', 1) ->where('pay_status', '=', 3) ->whereBetweenTime('create_time', $beginTime, $endTime) ->hasWhere('orderGoods', ['goods_id'=> $goodsId]) ->select(); ``` 报错提示:`SQLSTATE[42S02]: Base table or view not found: 1051 Unknown table...
https://github.com/top-think/think-orm/blob/0b01a19654c3b0376043960a30e74c9ddb55d574/src/db/PDOConnection.php#L868 测试代码 ```php \think\facade\Db::event('before_find', function ($query) { return false; }); ``` ` $result = $this->db->trigger('before_find', $query); `返回结果 ```php Array ( [0] => ) ``` 所以这个代码块永远不会被执行. https://github.com/top-think/think-orm/blob/0b01a19654c3b0376043960a30e74c9ddb55d574/src/db/PDOConnection.php#L870 所以这个代码块永远不会被执行. 希望官方尽快解决一下. 我的修改方式是去除空数组 ```php...
在配置有多个数据库的情况下,model::withCount不能生成正确的sql语句,如下 ``` SELECT COUNT(*) AS think_count FROM `xxx_table` `count_table` WHERE ( ( `count_table`.`xxx_field` =xxx ) ) AND `count_table`.`delete_time` = '0' ``` 生成的sql语句不会带上相应的连接信息导致PDO报错。
CREATE TABLE `test` ( `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '表自增id', `order_no` bigint NOT NULL DEFAULT '0' COMMENT '分单编号', `order_sn` bigint NOT NULL DEFAULT '0' COMMENT '订单编号', `update_time` int...
版本:v2.0.40 ```php

我的数据库连接信息是保存在默认数据库里的,现在想使用动态连接,但是我看了下,只支持从默认配置读取,请问怎么实现这个需求
https://github.com/top-think/think-orm/blob/1af5d8d82a6a928ba19ea3dba70fd0cf7f2129ac/src/Model.php#L880 实在想不通,返回`$model`本身的意义何在。链式操作吗,但我还真没用过这个链式操作。 `Model::where($where)->update($date)->dowhat();?`; 即使真有这种需求,赋值到一个变量就行了。 ```php $model = new Model; $model->where($where)->update($data); $model->dowhat(); ``` 相反的,用模型更新的时候,为了知道操作是否成功,不得不写很多代码。 ```php $model = new Model; $res = $model->isUpdate(true, $where)->save($data); ``` 再简便点,但总觉得有点怪怪的。 ```php $res = (new Model)->isUpdate(true, $where)->save($data);...
RT,这个是基于什么考虑 ``` /** * 删除当前的记录 * @access public * @return bool */ public function delete(): bool { if (!$this->exists || $this->isEmpty() || false === $this->trigger('BeforeDelete')) { return false; } //...