2013-06-27 57 views
0

當我使用compser.phar使一個Symfony2的項目更新:ParameterNotFoundException:您已請求不存在的參數「database_accounts_driver」

php composer.phar update 

我有這樣的錯誤,當我更新後運行該項目:

ParameterNotFoundException: You have requested a non-existent parameter "database_accounts_driver". 

這裏是我的config.yml:

# Doctrine Configuration 
doctrine: 
dbal: 
    default_connection:  default 
    connections: 
     default: 
      driver: "%database_driver%" 
      host:  "%database_host%" 
      port:  "%database_port%" 
      dbname: "%database_name%" 
      user:  "%database_user%" 
      password: "%database_password%" 
      charset: UTF8 
     accounts: 
      driver: "%database_accounts_driver%" 
      host:  "%database_accounts_host%" 
      port:  "%database_accounts_port%" 
      dbname: "%database_accounts_name%" 
      user:  "%database_accounts_user%" 
      password: "%database_accounts_password%" 
      charset: UTF8 

也是我parameter.yml:

parameters: 
database_driver: pdo_mysql 
database_host:  127.0.0.1 
database_port:  ~ 
database_name:  symfony 
database_user:  root 
database_password: ~ 

mailer_transport: smtp 
mailer_host:  127.0.0.1 
mailer_user:  ~ 
mailer_password: ~ 

locale:   en 
secret:   ThisTokenIsNotSoSecretChangeIt 

最後我appkernel:

$bundles = array(
     new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), 
     new Symfony\Bundle\SecurityBundle\SecurityBundle(), 
     new Symfony\Bundle\TwigBundle\TwigBundle(), 
     new Symfony\Bundle\MonologBundle\MonologBundle(), 
     new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), 
     new Symfony\Bundle\AsseticBundle\AsseticBundle(), 
     new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), 
     new JMS\AopBundle\JMSAopBundle(), 
     new JMS\DiExtraBundle\JMSDiExtraBundle($this), 
     new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(), 

任何想法?

回答

1

正如我所看到的,是不是database_accounts_driver在YOUT parameters.yml 定義你database_driver,DATABASE_HOST,數據庫名稱...買不database_ACCOUNTS_driver(也沒有database_accounts_host,等...)

如果您要使用不同的參數和默認帳戶配置,您必須在您的parameters.yml定義是:

parameters: 
    database_driver: pdo_mysql 
    database_host:  127.0.0.1 
    database_port:  ~ 
    database_name:  symfony 
    database_user:  root 
    database_password: ~ 

    database_accounts_driver: pdo_mysql 
    database_accounts_host:  127.0.0.1 
    database_accounts_port:  ~ 
    database_accounts_name:  whatever 
    database_accounts_user:  whatever 
    database_accounts_password: blablabla 

    mailer_transport: smtp 
    mailer_host:  127.0.0.1 
    mailer_user:  ~ 
    mailer_password: ~ 

    locale:   en 
    secret:   ThisTokenIsNotSoSecretChangeIt 
+1

注:考慮到,也許如果你寫在parameters.yml那些行帳戶,然後更新作曲家,如果你沒有在parameters.yml.dist中寫出這些行,也許他們可以消失(因爲composer按照parameters.yml.dist的結構更新parameters.yml) –

相關問題