Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

Is there away to create active record model in Yii for portioned tables in PostgreSQL?

I have100 postgres table (TABLE_0 - TABLE_99 ) inherited from MAINTABLE it there any way using YII framework to create model for this tables using activerecord class

user-image
Question ajoutée par Khadijah Shtayat , Technical Lead , Opensooq
Date de publication: 2013/09/08
Amr Olabi
par Amr Olabi , Technical Team Lead , Smart Charging Technologies

Yes you can since it's Yii :)

Easily create normal model for main table, and make table name change before running your operation; query(), save(), delete(), and so on.

 

To change table name, you need to use before and after capability that Yii support, and specially CActiveRecord, like overriding beforeSave and afterSave functions for save function.

 

Changing table name is tricky, since CActiveRecord functions takes table name from table meta data, so you need to flush this data after changing table name, and don't forget to revert table name to original table name after your operation, to make the object works normally.

More Questions Like This

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?