beberlei / zf-doctrine

A Zend Framework 1.x and Doctrine 1.2 Integration - UNMAINTAINED
101 stars 21 forks source link

README clarification regarding model and table generation process #3

Closed wjgilmore closed 14 years ago

wjgilmore commented 14 years ago

Took me a while to figure this one out, in order to generate the database tables you must first generate your application models:

  1. zf generate-models-from-yaml doctrine
  2. zf build-project doctrine --load

Much of the confusion stems from the latter command in particular not actually reporting any errors related to the inability to generate tables. Some source debugging indicates that Doctrine will silently "create" a list of tables which have been populated into an array as a result of loading the application models, however Doctrine will not report an error when that array happens to be empty, which is the case when the above command #1 is not executed first.

[Edit: Finally, to load your fixtures after executing the above two commands, execute zf load-data doctrine. Works like a charm. :-)]

Thanks! Jason

oliverturner commented 14 years ago

In the case of a modular set-up, you may also need to create a module bootstrap containing something like the following: class Default_Bootstrap extends Zend_Application_Module_Bootstrap { protected $_moduleName = 'default';

    protected function _initConfiguration()
    {
        $options = $this->getApplication()->getOptions();
        $libPath = '/modules/' . $this->_moduleName . '/library';

        set_include_path(implode(PATH_SEPARATOR, array(
            realpath(APPLICATION_PATH . $libPath),
            get_include_path(),
        )));

        return $options;
    }
}

And then add autoloadernamespaces[] = "Default" to your main application ini