PHP Doctrine ORM newbie - Valid DSN for dropping database?

I'm going through the tutorials for doctrine and liking it so far, however I'm stuck at the point of dropping/regenerating the db schema. This is the code I am using (pretty much straight from the tutorial) require_once(dirname(__FILE__) . '/lib/vendor/doctrine/Doctrine.php'); spl_autoload_register(array('Doctrine', 'autoload')); $manager = Doctrine_Manager::getInstance(); $manager->setAttribute(Doctrine::ATTR_AUTO_ACCESSOR_OVERRIDE, true); $manager->setAttribute(Doctrine::ATTR_AUTOLOAD_TABLE_CLASSES, true); $dsn = 'mysql:dbname=test;host='; $user = 'root'; $password = 'test'; $dbh = new PDO($dsn, $user, $password); $conn = Doctrine_Manager::connection($dbh); $conn->setOption('username', $user); $conn->setOption('password', $password); Doctrine::loadModels('models'); Fatal error: Uncaught exception 'Doctrine_Connection_Exception' with message 'You must create your Doctrine_Connection by using a valid Doctrine style dsn in order to use the create/drop database functionality' Can anyone tell me the correct syntax to use for the DSN, the examples given are a little confusing. I'm running on localhost through XAMPP. Any advice appreciated. Thanks.

以上就是PHP Doctrine ORM newbie - Valid DSN for dropping database?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » WebStorm

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准