alnasfire
alnasfire

Reputation: 720

How to import CArrayDataProvider to controller

Sorry for my stupid question, I'm realy newbie with Yii, but I don'n know how to import CArrayDataProvider to my controller class. I've found one way Yii::import('application.extensions.CArrayDataProvider'); (after this call I got error Call to undefined method Yii::import()) but it isn't work for me, because I haven't folder extensions at all in my project (I use yii basic application). Please tell me, how add CArrayDataProvider in correct way.

In my yii 2 basic application folder there no file with name CArrayDataProvider. May be I should add some refference to yii framework from my application? I installed application from archive file.

Upvotes: 2

Views: 592

Answers (2)

Chinmay Waghmare
Chinmay Waghmare

Reputation: 5456

CArrayDataProvider is replaced with ArrayDataProvider in Yii2. For using it you just need to include it in a file. Put the below in the beginning of your file.

use yii\data\ArrayDataProvider;

For more details refer to this link

Upvotes: 2

André Silva
André Silva

Reputation: 1108

You are probably referring to yii\data\ActiveDataProvider that Yii uses by default in their Search models. You should look at its documentation.

Upvotes: 0

Related Questions