Working With 3Rd Part Database That Isn't Managed By Yii


I was wondering what the best way to deal with 3rd party databases that are managed by another application. I’m new to MVC, and to the Yii framwork, so I’m confused as to how to go about doing this. From what I’ve seen in the tutorials, most tables have a Model representing it that can be used to update and change values in the database. however, the database that i will be using is updated by another application. So what is the conventional way of dealing with such tables?

Hi, and welcome to the forum.

Should your app write data directly to the database? If so, you can do it. If not, you may have to use the other application (via an API?) to do it.

If you don’t need to write to the database at all, there are no problems: you can still use the AR models to read from it.

No, my applications doesn’t need to write to those tables. All that is managed by a 3rd party app. But this is what is confusing me:

"you can still use the AR models to read from it"

Does that mean I have to write a model for use table to use it? Because that is not optimal - there are over a hundred managed by the 3rd party app… =/

No, you don’t. :)

Check DAO on the guide.