Symfony 2 database_driver问题

时间:2015-02-22 19:41:41

标签: symfony jobeet

我试图开始使用Symfony 2,所以我开始阅读并关注jobeet教程。当我尝试使用此命令创建数据库时出现问题" php app / console doctrine:database:create",我收到此错误:

Symfony\Component\Config\Exception\FileLoaderLoadException]
here is no extension able to load the configuration for "database_driver"     (in C:\wamp\www\jobeet\app/config\parameters.yml). Looked for namespace "databas
_driver", found "framework", "security", "twig", "monolog", "swiftmailer", "assetic", "doctrine", "sensio_framework_extra", "oc_platform", "ens_jobeet", "
ebug", "acme_demo", "web_profiler", "sensio_distribution" in C:\wamp\www\jobeet\app/config\parameters.yml (which is being imported from "C:\wamp\www\jobee
\app/config\config.yml").

Symfony\Component\DependencyInjection\Exception\InvalidArgumentException]
here is no extension able to load the configuration for "database_driver" (in C:\wamp\www\jobeet\app/config\parameters.yml). Looked for namespace "databas
_driver", found "framework", "security", "twig", "monolog", "swiftmailer", "assetic", "doctrine", "sensio_framework_extra", "oc_platform", "ens_jobeet", "
ebug", "acme_demo", "web_profiler", "sensio_distribution"

这是我的parameters.yml文件内容:

database_driver:pdo_mysql

database_host: 127.0.0.1
database_port: null
database_name: jobeet
database_user: root
database_password: null
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: null
mailer_password: null
locale: en
secret: ThisTokenIsNotSoSecretChangeIt

如果有人能帮助我,我会非常感激。

1 个答案:

答案 0 :(得分:1)

你的参数不好。您应该添加参数:key作为“顶级”键,如下所示

parameters:
  database_driver: pdo_mysql
  database_host: 127.0.0.1
  database_port: null
  database_name: jobeet
  database_user: root
  database_password: null
  mailer_transport: smtp
  mailer_host: 127.0.0.1
  mailer_user: null
  mailer_password: null
  locale: en
  secret: ThisTokenIsNotSoSecretChangeIt

此外,我可以注意到你使用root用户作为db用户而且你不需要密码:这通常是一种不好的做法。

最后改变秘密令牌