小编ris*_*ish的帖子

Idiorm find_many()只返回一个对象

我已经和idiorm玩了几天了,一点一点地设法让它真正开始执行查询.我遇到了一些有点奇怪的东西,我无法弄明白.find_many()函数只返回一条记录,它始终是数据库中的最后一条记录.例如,我通过mysqli执行以下查询,并在数据库中获取所有16个用户:

// connection is just a singleton instance to manage DB connections    
$connection->getRawInstance()->getRawConnection()->query('select * from users'));

// The result of this is all 16 users
Run Code Online (Sandbox Code Playgroud)

现在,当我在idiorm中执行等效查询时,我只获得user16,即数据库中的最后一个.

\ORM::configure('mysql:host=localhost;dbname=------');
\ORM::configure('username', '----');
\ORM::configure('password', '----');
\ORM::configure('logging', true);

$people = \ORM::forTable('users')->findMany();
Run Code Online (Sandbox Code Playgroud)

有人知道为什么吗?

php idiorm

5
推荐指数
1
解决办法
1344
查看次数

标签 统计

idiorm ×1

php ×1