0

I'm trying to integrate Doctrine 2 into Zend Framework (I'm new to ZF). I've look everywhere on the net but couldn't find my answer...

I've followed this recent tutorial: http://hectorpinol.com/zend-framework-1-11-and-doctrine-2-2-x-integration/ and I've managed to generate a table using the CLI.

The last step of the tuto is to add a new line in this table, simply using the Index controller. But my website doesn't work anymore (a brutal error 500, no message) because I changed the bootstrap.

if I remove the last lines I added to the _initDoctrine() method, it works again (but without Doctrine of course). Here they are:

    // set the proxy dir and set some options
    $config->setProxyDir(APPLICATION_PATH . '/models/Proxies');
    $config->setAutoGenerateProxyClasses(true);
    $config->setProxyNamespace('App\Proxies');

    // now create the entity manager and use the connection
    // settings we defined in our application.ini
    $connectionSettings = $this->getOption('doctrine');
    $conn = array(
        'driver'    => $connectionSettings['conn']['driv'],
        'user'      => $connectionSettings['conn']['user'],
        'password'  => $connectionSettings['conn']['pass'],
        'dbname'    => $connectionSettings['conn']['dbname'],
        'host'      => $connectionSettings['conn']['host']
    );
    $entityManager = \Doctrine\ORM\EntityManager::create($conn, $config);

    // push the entity manager into our registry for later use
    $registry = Zend_Registry::getInstance();
    $registry->entitymanager = $entityManager;

    return $entityManager;

Do you have any idea to unlock the situation? It's frustrating because I know I'm so close to make it work...

UPDATE1: I forgot to mention, in case it helps: I'm using WAMP on Windows. Thanks

UPDATE2: Added the parameters of the create() function.

UPDATE3: Actually it might not be an error 500. Chrome says this but Firefox just displays nothing. No answer from the server.

3
  • Why did all the comments & answers disappeared?? Jul 26, 2012 at 14:32
  • Because what I thought was the problem, is not the problem. You'll need to find someone else who can help. I'm not sure what the problem is.
    – nwalke
    Jul 26, 2012 at 20:27
  • OK, I was wondering what happened! I'm still looking for my answer. Now I'm trying it on Linux... Jul 26, 2012 at 20:56

1 Answer 1

0

1) Change the environment to development to see the error message.

2) Use Bisna library instead, will save a lot of time (I don't see a point in integrating Doctrine manually well only educational purposes but you might want to save it for later).

5
  • Thanks for that advice, I'll try to use that library and give you the feedback. I'm already in development environment. Cheers. Jul 27, 2012 at 8:39
  • I'm trying to understand that page about Bisna's library (kurttest.com/zfa/bisna.html) but the explanation are not clear for me, a beginner. Isn't there an other tuto/explanation available? Jul 27, 2012 at 10:59
  • @GuilhemSoulas not really, not much to do with it. Take a look at this Guilherme Blanco's (the guy behind this library) skeleton project at github: github.com/guilhermeblanco/ZendFramework1-Doctrine2 You just need to copy Zend folder to library and Doctrine (see application.ini lines 38 - 54 where the Bisna library expects to find the Doctrine).
    – Gediminas
    Jul 27, 2012 at 17:51
  • I'll have a look this weekend. If it's that easy I should make it work. Cheers. Jul 27, 2012 at 20:56
  • I fixed the errors in the Apache log but it's still not ready to work. I suppose I'll be able to do it when I'll know Zend and Doctrine a little bit more. Jul 29, 2012 at 17:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.