且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Symfony2:ClassACE和ObjectACE

更新时间:2023-11-19 19:03:04

我已解决!

问题出在用户实体的getRoles方法上

The problem was on the getRoles method on User Entity.

之前是这样的:

function getRoles() {
    return $this->roles->toArray();
}

我已更改为:

function getRoles()
{
    $roles = array();
    foreach($this->userRoles as $userRole) {
        $roles[] = $userRole->getRole();
    }
    return $roles;
}

如果有人知道我为什么会升值

If anyone knows why I would appreciate