doufu3718 2016-01-08 14:43
浏览 50
已采纳

在symfony中更新数据库模式时发生异常

I am pretty new to Symfony and Doctrine and as such have been playing around with a branch of some code which I will need to be working on commercially in the near future.

To cut a long story short I am at the stage now where I have amended an existing entity in order to add a new parameter. I have updated the ORM annotation to represent this, as I understand it if I run the following:

php app/console doctrine:migrations:diff

This should automatically update the database table to add a new column to accommodate my new property. However when I run it I get the following error:

 [Doctrine\DBAL\Exception\ConnectionException]                                                                                                      
  An exception occured in driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known  

Its probably worth noting that the project is already communicating with the database successfully when you interact with it via forms in the browser so i'm rather confused why this error is appearing?

I am also running the database on a docker container, which I assume is probably contributing to this error.

Any ideas?

  • 写回答

1条回答 默认 最新

  • douchun1900 2016-01-08 15:20
    关注

    In order for symfony2 to be able to communicate with your database, you will need to set the correct parameters in app/config/parameters.yml.

    On initial installation using composer the command line could also ask for these paramters (database, username, password and hostname).

    No matter which method is used, at the long last you'll find them in app/config/parameters.yml.

    Good luck!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么