I would really like to see an example of Doctrine integrated as a module as well.
- Steve W. dbroderick wrote: > > I am using ZF 1.8.4 and Doctrine 1.1.2 with a module directory setup of > > > +---application > | +---configs > | \---modules > | +---default > | | +---controllers > | | \---views > | | \---scripts > | | +---error > | | \---index > | +---error > | | +---controllers > | | \---views > | | \---scripts > | | \---error > | \---user > | +---controllers > | +---models > | | \---generated > | \---views > | \---scripts > | \---index > +---library > | \---App > | \---Application > | \---Resource > +---public > | +---images > | \---themes > | \---default > | \---css > \---tests > +---application > \---library > > > I have a resource file called Doctrine.php in my library folder which does > the following: > > > $zla = Zend_Loader_Autoloader::getInstance(); > $zla->unshiftAutoloader( array( 'Doctrine', 'autoload' ), 'Doctrine' > )->setFallbackAutoloader( true ); > > > $manager = Doctrine_Manager::connection( $this->_getConnectionString() ); > $manager = Doctrine_Manager::getInstance(); > $manager->setAttribute( Doctrine::ATTR_MODEL_LOADING, > Doctrine::MODEL_LOADING_CONSERVATIVE ); > $manager->setAttribute( Doctrine::ATTR_PORTABILITY, > Doctrine::PORTABILITY_NONE ); > $manager->setAttribute( Doctrine::ATTR_AUTOLOAD_TABLE_CLASSES, true ); > $manager->setAttribute( Doctrine::ATTR_USE_DQL_CALLBACKS, true ); > $manager->setAttribute( Doctrine::ATTR_AUTO_ACCESSOR_OVERRIDE, true ); > > > My config xml file has this: > > > --- snip --- > > > <pluginPaths> > > <App_Application_Resource><![CDATA[App/Application/Resource]]></App_Application_Resource> > </pluginPaths> > <resources> > <frontController> > > <defaultmodule><![CDATA[default]]></defaultmodule> > <params> > > <prefixDefaultModule><![CDATA[true]]></prefixDefaultModule> > > <usedefaultcontrolleralways><![CDATA[false]]></usedefaultcontrolleralways> > </params> > </frontController> > <modules> > <default><![CDATA[default]]></default> > <error><![CDATA[error]]></error> > <user><![CDATA[user]]></user> > </modules> > <!-- Doctrine application plugin --> > <doctrine> > <dbtype><![CDATA[dbtype]]></dbtype> > <dbhost><![CDATA[localhost]]></dbhost> > <dbname><![CDATA[dbname]]></dbname> > <dbuser><![CDATA[dbuser]]></dbuser> > <dbpass><![CDATA[dbpass]]></dbpass> > </doctrine> > <!-- View application plugin --> > <view><![CDATA[view]]></view> > </resources> > > > --- snip --- > > > The default Module Autoloader is loaded correctly during bootstrapping, > making available the default resource types (form, model, dbtable), but I > use Doctrine so dbtable is not used and I would like to insert, override > or even replace the default resource type(s) with a folder in models that > Doctrine uses which is 'generated'. > > > My preference is that when my Resource Plugin which configures Doctrine as > my DB layer, also can inject the needed resource type into the default > module autoloader, in order to make the configuration available in all > modules. > > > I have tried for the past day to get this to work but all of the examples > I find are to create a module autoloader in the module bootstrap file > which means (as I understand it) that I have to do this for each module > bootstrap. > > > I am still new to Zend and struggling a bit with the changes in v1.8, so I > may have just missed the example that shows how this is done. > > > Of course my ultimate problem here is that when I try to load a model > User.php in the models folder which extends generated\BaseUser.php, the > BaseUser class is not found. > > Thanks, > David > -- View this message in context: http://www.nabble.com/Zend-Framework-%2B-Doctrine-Module-Autoloader-issue-tp24392765p24414344.html Sent from the Zend Framework mailing list archive at Nabble.com.