alnasfire alnasfire - 4 months ago 17x
PHP Question

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

to my controller class. I've found one way
(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.


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