Yii 1.1: doctrine-yii

Doctrine Integration

Integrates Doctrine with Yii applications




Change Log

May 28, 2009

  • Initial release.

Total 3 comments

#1439 report it
SilentWarrior at 2009/08/02 01:46pm

After a bit of testing stuff out I found that the best solution would probably be :

Adding this to the model (generated by doctrine) public static function model($className=CLASS) { return Doctrine::getTable($className); }

So you can then just do :

$user = User::model()->findOneByEmail($mail);

Instead of : $user = Doctrine::getTable('User')->findOneByEmail($mail);

This would be used to replicate the Yii AR implementation in models : $user=User::model()->find('LOWER(email)=?',array($mail));

#1444 report it
SilentWarrior at 2009/08/01 07:18am


When I say "class Cliente" I meant "class User".

Btw, would it be possible to get a quick example of this working?

#1445 report it
SilentWarrior at 2009/08/01 07:13am

Hey, after you implement doctrine inside yii, how will you use the Yii model scheme but with doctrine?

Right now you do:


While having User defined as 'class User extends CActiveRecord', right?

If i then change it to Doctrine, using 'class Cliente extends Doctrine_Record', will Yii accept it as its child? so i can do:



// test.php

// ... $userTable = Doctrine::getTable('User');

$user = $userTable->find(1);


Will assume I then have to use CFormModel as a class for all models I want to work with Yii functions, such as : (class UserSearchForm extends CFormModel) $form=new UserSearchForm; $form->attributes=$_POST['UserSearchForm'];

$listDB = $form->simpleSearch(); //my search function with Doctrine query inside it.

Leave a comment

Please to leave your comment.

Create extension
  • Yii Version: 1.1
  • License: Other Open Source License
  • Developed by: thiagovarela
  • Category: Database
  • Votes: +2
  • Downloaded: 796 times
  • Created on: May 28, 2009
  • Last updated: May 28, 2009