Codeigniter and Doctrine 500 internal error

2019-08-17 16:31发布

问题:

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.

回答1:

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.



回答2:

Make sure to put some content in fields that cannot be null.