I'd like to use a set of DBF files as my yii app's database. Please suggest a documentation for implementing custom models in yii framework?
-
Looks like, I need to implement CDbConnection and override CActiveRecord::getConnection() yiiframework.com/doc/guide/1.1/en/database.daoKarthik Murugan– Karthik Murugan2011-08-09 09:13:21 +00:00Commented Aug 9, 2011 at 9:13
-
Honestly, wouldn't it just be better to export the data in the DBF files into a modern database?k to the z– k to the z2011-08-09 18:12:51 +00:00Commented Aug 9, 2011 at 18:12
-
Agree, but we want to use the DBF files "as is" from another system. We will have to periodically update the files.Karthik Murugan– Karthik Murugan2011-08-10 04:03:51 +00:00Commented Aug 10, 2011 at 4:03
-
That sucks. Tell your boss he is slowly killing your soul.k to the z– k to the z2011-08-11 14:24:10 +00:00Commented Aug 11, 2011 at 14:24
1 Answer
It partly depends on if you are going to use it as the only database or want to support multiple databases. If it's your only database and assuming you have the PDO driver, you can set up your database connection in the Yii config/main.php file. I don't believe it would support Active Record, however, so as @ktothez mentioned, you might be better off importing it to a database that does.
If you want to support multiple databases and have the PDO driver, you can set a new database connection via CDbConnection.
Otherwise you could simply make your own custom class and deal with it that way by fetching your custom data, storing in an array and then use Yii's array functions instead of AR functions.