我有一个有效的phalcon应用程序。我把它从Windows移动到Linux服务器一切正常。但是当我想使用phalcon模型findby resultset时,它会返回不同的结果。我使用Phalcon 2.0.13
$userRoles = UserRoles::findByUserId($userId);
var_dump($userRoles->count()); //Returns -1
var_dump(count($userRoles)); // Returns -1
var_dump(count($userRoles->toArray())); // Returns 3 and when i var_dump result result is right there are 3 records
foreach ($userRoles as $role) { //This foreach doesnt work because result length is -1
$roleArr = Auth::rolesParse($role->role_id);
$roles = array_merge_recursive($roles, $roleArr);
}
我有很多此代码的示例,因此将所有结果集转换为数组对我来说不是解决方案。我不知道是关于php扩展,配置还是phalcon配置
(array)[Number of Elements: 3]
0:
(array)[Number of Elements: 3]
"id":
(string) 2049
"role_id":
(string) 1
"user_id":
(string) 28
1:
(array)[Number of Elements: 3]
"id":
(string) 2050
"role_id":
(string) 2
"user_id":
(string) 28
2:
(array)[Number of Elements: 3]
"id":
(string) 2051
"role_id":
(string) 3
"user_id":
(string) 28