How To Use Yii With API Data And Database

Hello all,

I am completely new here. I begin my first project in Yii. After reading both Yii books I have a question left about my project I want to start.

The program I am going to build requests items from an API. Because the API calls are limited, I cache the items in a MySQL database.

The question is. Should I have two models one for the API access functions, and one for MySQL? I know the latter do I have to create for sure. I am just unsure about the API functions.

Do I place the code for the API in the controller, or just create the Model for it?


To clarify some thoughts:

The question is more about which models to create.

I know I do need a database model, but the API calls are only made when the cached data from the database is expired. Lets say after one hour.

Maybe this may clear things up. Thanks!

No body have any clue?