Hi,
Hope this will help:
http://weierophinney.net/matthew/archives/220-Autoloading-Doctrine-and-Doctrine-entities-from-Zend-Framework.html

<http://weierophinney.net/matthew/archives/220-Autoloading-Doctrine-and-Doctrine-entities-from-Zend-Framework.html>
Regards,
Svetlin Tsvetanov

On Sun, Oct 18, 2009 at 2:49 AM, admirau <[email protected]> wrote:

>
> 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.
>
>


-- 
Svetlin Tsvetanov
PHP Lead
[email protected]

This email and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed.
If you have received this email in error please notify the system manager.
This message contains confidential information and is intended only for the
individual named. Please notify the sender immediately by e-mail if you have
received this e-mail by mistake and delete this e-mail from your system. If
you are not the intended recipient you are notified that disclosing,
copying, distributing or taking any action in reliance on the contents of
this information is strictly prohibited. Any views or opinions presented in
this email are solely those of the author and do not necessarily represent
those of the company.

Reply via email to