symfony2:在类中插入ace

时间:2012-07-18 22:18:23

标签: php symfony-2.1

我在课堂上尝试添加ace时出现此错误:

  

警告:PDO :: quote()期望参数1为字符串,对象在... / vendor / doctrine / dbal / lib / Doctrine / DBAL / Connection.php第568行中给出

我的代码:

$oid = new ObjectIdentity('class', new Post());

$aclProvider = $this->get('security.acl.provider');

try {
    $acl = $aclProvider->createAcl($oid);
} catch (AclAlreadyExistsException $exists) {
    return;
}

$builder = new MaskBuilder();
$builder->add('view');
$mask = $builder->get();

$acl->insertClassAce(new RoleSecurityIdentity('IS_AUTHENTICATED_ANONYMOUSLY'), $mask);

$aclProvider->updateAcl($acl);

有什么想法吗?

0 个答案:

没有答案