问题描述
我想使用 Symfony 的 ACL 系统,但我无法初始化数据库.我按照这里的步骤 How to使用访问控制列表 (ACL),但是当我运行控制台命令时,我得到 init"命名空间中没有定义任何命令.
I would like to use Symfony's ACL system but I am unable to initialize the database. I followed the steps here How to Use Access Control List (ACL's), but when I run the console command I get There are no commands defined in the "init" namespace.
我在我的 AppKernel new Symfony\Bundle\SecurityBundle\SecurityBundle()
中定义了 SecurityBundle.这是我的 security.yml
I have the SecurityBundle defined in my AppKernel new Symfony\Bundle\SecurityBundle\SecurityBundle()
. And here is my security.yml
# security.yml
security:
acl:
connection: default
我不太明白我错过了什么.我确实理解这可能是配置问题.查看 symfony 库中的命令,我看到了
I'm not quite understanding what I'm missing. I do understand though that it's likely a configuration issue. Looking at the Command in symfony's library I see
<?php
class InitAclCommand extends ContainerAwareCommand
{
/**
* {@inheritdoc}
*/
public function isEnabled()
{
if (!$this->getContainer()->has('security.acl.dbal.connection')) {
return false;
}
return parent::isEnabled();
}
//...
}
我的猜测是 isEnabled()
返回 false,但我不确定我为此设置了什么或在哪里设置.
My guess is isEnabled()
is returning false, but I'm not sure what or where I set the configuration for this.
我使用的是 Symfony 3.1.9 和 PHP7.0
I am using Symfony 3.1.9 and PHP7.0
谢谢
推荐答案
检查您是否安装了以下软件包:
check you have the following package installed:
composer require symfony/security-acl
这篇关于Symfony init:acl 命令丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!