My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
DoctrineComponent  
Updated May 28, 2009 by thiagova...@gmail.com

How to integrate Doctrine using DoctrineComponent

Installation

1 Extract Doctrine(http://www.doctrine-project.org) under application.vendors.doctrine folder

2 Put DoctrineComponent.php under the same folder protected

vendors

doctrine

Doctrine

Doctrine.php

DoctrineComponent.php

3 In your config file, preload doctrine component and configure the database string:

return array(
	'preload'=>array('log', 'doctrine'),

	// application components
	'components'=>array(
	

          'doctrine'=>array(
              'class' => 'application.vendors.doctrine.DoctrineComponent',
              'connectionString'=>'mysql://username:password@localhost/dbname',
          ),

...

Details

Doctrine will be autoloaded and you can use all the Doctrine functionalities.

Comment by jamesm...@gmail.com, Jul 5, 2009

You need to patch the init method.

spl_autoload_unregister(array('YiiBase','autoload'));
spl_autoload_register(array('Doctrine','autoload'));
spl_autoload_register(array('YiiBase','autoload'));

http://www.yiiframework.com/doc/cookbook/37/ for Yii version 1.0.6

Comment by pell...@gmail.com, Oct 31, 2010

On YII 1.1.4 (and probably earlier as well), you have to do the following:

  1. Patch the init method as mentioned above.
  2. Add the component to your preload array. In you app/protected/config/main.php, there is a 'preload' setting. Add 'doctrine' to that array.

Sign in to add a comment
Powered by Google Project Hosting