Codeigniter 和 Doctrine 500 内部错误
我尝试过将 Doctrine 与 Codeigniter 结合起来,我想我已经快成功了。 Codeigniter 的版本是 2.0.2,Doctrine 的版本是 2.0.0。
现在的问题是我使用Doctrine的flush()方法得到了500内部服务器错误。
我正在按照教程(http://wildlyinaccurate.com/integrating-doctrine-2-with-codeigniter-2/)使用codeigniter安装学说。但到了最后一步却失败了,我不知道为什么。
这是我在控制器中的代码:
$app = new models\application;
$app->setName("Test applicatie");
$app->setGuid();
$this->doctrine->em->persist($app);
$this->doctrine->em->flush(); //If I comment this out, it loads the view...
$this->load->view('welcome_message');
当我注释掉刷新方法时,它会加载视图。
提前致谢。
I've tried to combine Doctrine with Codeigniter and I'm almost there, I think.
The version of Codeigniter is 2.0.2 and from Doctrine is 2.0.0.
The problem is now that I get an 500 internal server error using the flush() method of Doctrine.
I am following a tutorial (http://wildlyinaccurate.com/integrating-doctrine-2-with-codeigniter-2/) to install doctrine with codeigniter. But at the last step it just fails and I don't know why.
This is my code in my controller:
$app = new models\application;
$app->setName("Test applicatie");
$app->setGuid();
$this->doctrine->em->persist($app);
$this->doctrine->em->flush(); //If I comment this out, it loads the view...
$this->load->view('welcome_message');
When I comment out the flush method it loads the view.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,由于
$this->doctrine->em->flush();
是实际写入数据库的内容,请确保您拥有执行数据库操作所需的 MySQL 用户权限行动。直接在 MySQL 中编写查询并确保不会在那里引发错误。
Well, since
$this->doctrine->em->flush();
is what actually does the write to the DB, Make sure you have the required MySQL user rights to do the DB action.Write the query directly in MySQL and make sure that the error isn't thrown there.
确保在字段中放置一些内容不能为空。
Make sure to put some content in fields that cannot be null.