2017-01-25 88 views
1

我想使用Symfony的ACL系統,但我無法初始化數據庫。我按照這裏的步驟How to Use Access Control List (ACL's),但是當我運行控制檯命令時,我得到There are no commands defined in the "init" namespace.Symfony init:acl命令丟失

我在我的AppKernel new Symfony\Bundle\SecurityBundle\SecurityBundle()中定義了SecurityBundle。這裏是我的security.yml

# security.yml 
security: 
    acl: 
     connection: default 

我不完全理解我失蹤。我明白,雖然這可能是一個配置問題。綜觀司令部symfony的圖書館我看到

<?php 
class InitAclCommand extends ContainerAwareCommand 
{ 
    /** 
    * {@inheritdoc} 
    */ 
    public function isEnabled() 
    { 
     if (!$this->getContainer()->has('security.acl.dbal.connection')) { 
      return false; 
     } 

     return parent::isEnabled(); 
    } 
    //... 
} 

我的猜測是isEnabled()正在恢復假的,但我不知道是什麼或者我設置的配置這一點。

我使用的Symfony 3.1.9和PHP7.0

感謝

回答

0

檢查已安裝了以下包:

composer require symfony/security-acl 
0

嘗試鍵入以下命令:

composer require symfony/security-acl 

然後:

composer update 

然後運行:

php bin/console init:acl 

這應該工作