deepan raj
deepan raj

Reputation: 21

Scenario to use YII DataProvider

Can any one please explain me what are all the best scenario to use particular dataprovider.

For ex :

Upvotes: 2

Views: 103

Answers (1)

Jelle de Fries
Jelle de Fries

Reputation: 875

  1. CActiveDataProvider - Use this if you have a list of models (uses findAll()).
  2. CArrayDataProvider - Use this when you have a raw array of objects which is not a list of models.
  3. CSqlDataProvider - Use this when you have a database query resulting in a list of objects and not a list of models.

You can use all three of them to construct html with for example the (default) widgets.

The docs are quite clear on when and how to use the three:

  1. CActiveDataProvider
  2. CArrayDataProvider
  3. CSqlDataProvider

Upvotes: 1

Related Questions