0

我有一个有效的 phalcon 应用程序。我将它从 Windows 移动到 linux 服务器,一切正常。但是当我想使用 phalcon 模型 findby 结果集时,它会返回不同的结果。我使用 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
4

0 回答 0