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;

Code:

$connection=Yii::app()->db;

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


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

where(‘user_id=:id’,array(’:id’=>Yii::app()->user->getId()))->queryAll();

    //$rows=$command->execute();


    foreach($rows as $row){


        //process each item here


        $pid=$row['project_id'];


        //echo $pid;


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

where(‘id=:pid’,array(’:pid’=>$pid))->queryAll();

        //$rows2=$command2->execute();


        $arr=array();


        $i=0;


        foreach($rows2 as $row) {


            $arr=array(


                $i=>array(


                    'id'=>$row['id'],


                    'name'=>$row['name'],


                    'description'=>$row['description'],


                    'create_time'=>$row['create_time'],


                    'create_user_id'=>$row['create_user_id'],


                    'update_time'=>$row['update_time'],


                    'update_user_id'=>$row['update_user_id']


                ),


            );


        }


    }


    $dataProvider=new CArrayDataProvider([


        'allModels' => $arr,


        'pagination' => [


            'pageSize' => 10,


        ],


        'sort' => [


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


        ],


    ]);


	$this->render('index',array(


		'dataProvider'=>$dataProvider,


	));

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]