Import - not working


ok i don’t know if this is the right place - so i put it here sorry if not.

Buy the way im not native english speaking so sorry for bad English too!!!

So here–>

I would like to import the Class ArrayDataProvider

as described here:

it doesn’t work.


[i][i][i]PHP Error


include(ArrayDataProvider.php) [<a href=‘function.include’>function.include</a>]: failed to open stream: No such file or directory

Source File




00396: //test-----------------------------


00398: // use include so that the error PHP file may appear

00399: if(isset(self::$_coreClasses[$className]))

00400: include(YII_PATH.self::$_coreClasses[$className]);

00401: else if(isset(self::$classMap[$className]))

00402: include(self::$classMap[$className]);

00403: else

00404: {

00405: if(strpos($className,’\\’)===false)

00406: include($className.’.php’);

00407: else // class name with namespace in PHP 5.3

00408: {

00409: $namespace=str_replace(’\\’,’.’,ltrim($className,’\\’));

00410: if(($path=self::getPathOfAlias($namespace))!==false)

00411: include($path.’.php’);

00412: else

00413: return false;

00414: }

00415: return class_exists($className,false) || interface_exists($className,false);

00416: }

00417: return true;

00418: }



i have no clue where i am going wrong. I tried everything, copied the file i found:

ArrayDataProvider.php to CArrayDataProvider.php

->tried import, include and require with both files in the extensions directory and

the yii installation base directory (off course first copied the files there).

nothing works - why ???

appreciate any help or clue…

the right place to post it would be under extensions, as bug reports is only for yii core bugs


how did you import your file ?


was it this way ?

if yes make sure arrayDataProvider folder exists under the extensions folder and make sure the letter case is correct, like "arrayDataProvider" is different than "arraydataprovider"and it does matter in some systems

Please make sure that the file is called ‘ArrayDataProvider.php’, not ‘arrayDataProvider.php’ or ArrayDataprovider.php’ - it’s case sensitive.

I see that there’s a possible error in the instructions:


That could be


Maybe. :)

It depends on the exact case of the ArrayDataProvider directory.

Fix that.

And check the name of the php file itself.

This is a rookie mistake made by many Windows PHP programmers.

Always test your code against a Linux server.



guess i found it, thanX :D

For other users, who may have the same Problem:


"if yes make sure arrayDataProvider folder exists under the extensions folder"

thanks to Gustavo, i didn’t know that i needed a subdirectory.


1st - So if u want to import a class in the extension folder u need a subdirectory named

like the php file.

2nd - i made a big mistake, while including the File "ArrayDataProvider.php" the Class name

is CArrayDataProvider. And of course doing this

"$dataProvider = new ArrayDataProvider($arrayData);"

didn’t work so of course - stupid me - had to do this -->

"$dataProvider = new CArrayDataProvider($arrayData);"

But i stil got one question:

i wonder wether i should rename ArrayDataProvider.php to CArrayDataProvider.php

and create a subfolder named "…\extensions\CArrayDataProvider\"

and copy the file CArrayDataProvider.php there

because the Class name is CArrayDataProvider.

ok i already did that, but i would like to know if this is realy required.

I read somewhere - guess in

the forum - that the filename must be the same as the classname, thats why i’m asking.

Thanx for everyone for the help

Not true.

FYI there’s a CArrayDataProvider included in the framework core since version 1.1.4



Forgot my usual Bug Reports disclaimer: (not a core team member). Also, it’s a good idea to post to “General Discussion for Yii 1.1.x” if in doubt. (If beyond any doubt, create a ticket. Just don’t forget to first read The Definitive Guide to Yii)

thats nice,

well i almost smashed my head on the desk the last two days…

for nothing! just had to use CActiveDataProvider without import of any class.

thats nice