data provider not found error

Can anybody tell me what is the possible solution for the following code. It is giving me error that class CArrayDataProvider is not found.Although I have included the class on the top of the code:

use yii\framework\web\CArrayDataProvider;



    $user = Yii::app()->user->getId();

    $rows= $connection->createCommand()->select('*')->from('tbl_project_user_assignment')->



    foreach($rows as $row){

        //process each item here


        //echo $pid;

        $rows2= Yii::app()->db->createCommand()->select('*')->from('tbl_project')->





        foreach($rows2 as $row) {














    $dataProvider=new CArrayDataProvider([

        'allModels' => $arr,

        'pagination' => [

            'pageSize' => 10,


        'sort' => [

            'attributes' => ['id', 'name'],






You are trying to use yii\framework\web\CArrayDataProvider class which doesn’t exist. Yii 1.x branch predates PHP 5.3 and therefore isn’t namespaced. Just remove the use statement.

Also note that “use” statements don’t “include” or autoload anything, you need an actual autoloader implementation for that. (For core and application classes Yii 1 has a built in autolading mechanism, only 3rd party libraries may require additional steps.)

[color="#006400"]/* Moved from "2.0" to "1.1" */[/color]