alnasfire alnasfire - 2 years ago 97
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.

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download