-- monk.e.boy <[email protected]> wrote
(on Wednesday, 03 June 2009, 06:18 AM -0700):
> I have in my application bootstrap.php:
>
> protected function _initAutoLoad()
> {
>
> $autoloader = new Zend_Application_Module_Autoloader(array(
> 'namespace' => 'Default_',
> 'basePath' => dirname(__FILE__),
> ));
>
> return $autoloader;
> }
>
> Does the name of the method ( _initAutoLoad() ) mean anything?
Please read the documentation for Zend_Application. All _init* methods
will be executed by the bootstrap, and can be bootstrapped individually
(or the resource returned by the method retrieved) using the method name
minus the _init prefix.
> Why do I need to tell the application about my Models in the 'Default_'
> model namespace?
So that it can perform autoloading of those models. Typically, the
application/models directory is not on your include_path, and even if it
were, it should contain classes with their own vendor prefix.
Please read my devzone article on it for more information:
http://dz.zend.com/a/4525
> I can make a new model with the code:
>
> $c = new Default_Model_Table();
>
> In my module I have the following bootstrap.php:
>
> class Projects_Bootstrap extends Zend_Application_Module_Bootstrap
> {
> public function __construct($application)
> {
> parent::__construct($application);
> //echo "Projects Bootstrap loaded!";
> }
> }
>
> I my model I can make a new model with this code:
>
> $t = new Projects_Model_Table();
>
>
> How does the application know where these models are?
> Why don't I need to register the 'Projects_' namespace?
> Why is this different to the application bootstrap.php?
>
> Thanks for any help you can provide!
--
Matthew Weier O'Phinney
Project Lead | [email protected]
Zend Framework | http://framework.zend.com/