1

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?

4
  • Looks like, I need to implement CDbConnection and override CActiveRecord::getConnection() yiiframework.com/doc/guide/1.1/en/database.dao Commented 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? Commented 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. Commented Aug 10, 2011 at 4:03
  • That sucks. Tell your boss he is slowly killing your soul. Commented Aug 11, 2011 at 14:24

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. I'm doing exactly what you said in the last para.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.