Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

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 added by Khadijah Shtayat , Technical Lead , Opensooq
Date Posted: 2013/09/08
Amr Olabi
by 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

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.