Zend Framework - Doctrine ORM strange Zend Tool behavior.

Hold on Cowboy

This blog post is pretty old. Be careful with the information you find in here. It's likely dead, dying, or wildly inaccurate.

Zend Framework… awesome. Doctrine ORB… awesome.

Both of these combined…. PURE AWESOME.

I set up a project just at it says to on this page http://github.com/fmntf/zf-doctrine. It took some doing, but I got it working and was quite happy with my initial results. Then I needed to start a new project, so I just copied all the files, tweaked the DB name was flying with a new project… with one caveat.

One of the modules I created using a YAML file was not getting created in the DB when I ran zf build-project doctrine --reload. It was frustrating, I tried changing a bunch of things.

In the end the whole problem was that the module folder didn’t have a controllers folder and that was it. So I created a controllers folder and then it created the corresponding tables in the db. I think this code has much to do with it

application/Bootstrap.php bootstrap(‘Frontcontroller’);

$fc = $this->getResource(‘Frontcontroller’); $modules = $fc->getControllerDirectory();

foreach ($modules AS $module => $dir) { $moduleName = strtolower($module); $moduleName = str_replace(array(‘-’, ‘.’), ‘ ‘, $moduleName); $moduleName = ucwords($moduleName); $moduleName = str_replace(’ ‘, “, $moduleName);

$loader = new Zend_Application_Module_Autoloader(array( ‘namespace’ => $moduleName, ‘basePath’ => realpath($dir . “/../”), )); } }

}

Did this help you out? It took me a few days to piece together all this information together, I hope this saves you some time (who knows, maybe the future me will be thankful I wrote this down). Let me know your thoughts. shanestillwell@gmail.com