ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

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
تم إضافة السؤال من قبل Khadijah Shtayat , Technical Lead , Opensooq
تاريخ النشر: 2013/09/08
Amr Olabi
من قبل 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.

المزيد من الأسئلة المماثلة

هل تحتاج لمساعدة في كتابة سيرة ذاتية تحتوي على الكلمات الدلالية التي يبحث عنها أصحاب العمل؟