0

当我尝试在类中添加 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);

任何想法?

4

1 回答 1

1

尝试像这样定义您的对象身份:

$entityoid = new ObjectIdentity('class', 'YourComp\\YourBundleBundle\\Entity\\Post');
于 2012-08-17T11:58:17.823 回答