How to autoload Doctrine models?

My application structure looks like this:

/application/
/application/models/ Booking.php
/application/models/generated/
/application/models/generated/ BaseBooking.php

These two model files are:

// Bookind.php
class Booking extends BaseBooking {}

// BaseBooking.php
abstract class BaseBooking extends Doctrine_Record
{
    public function setTableDefinition()
    {
        $this->setTableName('booking');
        $this->hasColumn('type', 'string', 20, array(
             'type' => 'string',
             'length' => '20',
             ));
    }
}



Now, I'm supposed to do:

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{

    protected function  _initAppAutoload()
    {
       // Configure Zend_Loader_Autoloader_Resource here
    }

    public function _initDoctrine()
    {
            $al = Zend_Loader_Autoloader::getInstance();
            $al->registerNamespace('Doctrine');
            $al->pushAutoloader(array('Doctrine', 'autoload'), 'Doctrine_');

            $manager = Doctrine_Manager::getInstance();
            $manager->setAttribute(Doctrine::ATTR_MODEL_LOADING,
Doctrine::MODEL_LOADING_CONSERVATIVE);
            $manager->setAttribute(Doctrine::ATTR_AUTOLOAD_TABLE_CLASSES,
true);

            // test
            $booking = new Booking; // Booking, or something else?
    }
}


My questions are:
- How to rename, and where to put Booking.php and BaseBooking.php,
- how to configure _initAppAutoload

-- 
regards
takeshin
-- 
View this message in context: 
http://www.nabble.com/Autoload-Doctrine-Models-tp25942719p25942719.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to