Integrates Doctrine with Yii applications
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)
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 :
When I say "class Cliente" I meant "class User".
Btw, would it be possible to get a quick example of this working?
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:
$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.
Signup or Login in order to comment.