iceblock
(Prettyscripts)
November 16, 2010, 4:20am
1
When displaying CLinkColumn as first column in a grid:
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'transaction-grid',
'dataProvider'=>$dataProvider,
'columns'=>array(
array(
'class' => 'CLinkColumn',
'header' => 'ID',
'labelExpression' => '$data->id',
'urlExpression' => 'Yii::app()->createUrl("/transaction/view/?id=" . $data->id)',
),
// other columns
)
)) ?>
I get the following error:
YiiBase::include(CGridColumn.php) [<a href='yiibase.include'>yiibase.include</a>]: failed to open stream: No such file or directory
However the grid is displayed properly if other columns are displayed before the link column, eg
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'transaction-grid',
'dataProvider'=>$dataProvider,
'columns'=>array(
'id', // or any column name in the table
array(
'class' => 'CLinkColumn',
'header' => 'ID',
'labelExpression' => '$data->id',
'urlExpression' => 'Yii::app()->createUrl("/transaction/view/?id=" . $data->id)',
),
// other columns
)
)) ?>
Is this a bug or there are setups overlooked?
mdomba
(Maurizio Domba Cerin)
November 16, 2010, 10:42am
2
I just tryed this and it works for me… not sure what could be the reason…
anyway the CDataColumn and the CLinkColumn as the first statement has
Yii::import('zii.widgets.grid.CGridColumn');
Check that they are the same… could be that your CLinkColumn has some error?
iceblock
(Prettyscripts)
November 17, 2010, 12:31am
3
mdomba:
anyway the CDataColumn and the CLinkColumn as the first statement has
Yii::import('zii.widgets.grid.CGridColumn');
Check that they are the same… could be that your CLinkColumn has some error?
Yes, they are the same in both files.
I just upgraded my project to use Yii V115 and still have the same error.
Here’s the stack trace, wonder if you can detect what went wrong with this:
#0 path-to/www/_lib/yii/yii-1.1.5.r2654/framework/YiiBase.php(395): autoload()
#1 unknown(0): autoload()
#2 path-to/www/_lib/yii/yii-1.1.5.r2654/framework/YiiBase.php(391): spl_autoload_call()
#3 path-to/www/_lib/yii/yii-1.1.5.r2654/framework/YiiBase.php(391): autoload()
#4 path-to/www/_lib/yii/yii-1.1.5.r2654/framework/YiiBase.php(290): autoload()
#5 path-to/www/_lib/yii/yii-1.1.5.r2654/framework/YiiBase.php(190): import()
#6 path-to/www/_lib/yii/yii-1.1.5.r2654/framework/zii/widgets/grid/CGridView.php(264): createComponent()
#7 path-to/www/_lib/yii/yii-1.1.5.r2654/framework/zii/widgets/grid/CGridView.php(235): CGridView->initColumns()
#8 path-to/www/_lib/yii/yii-1.1.5.r2654/framework/web/CBaseController.php(140): CGridView->init()
#9 path-to/www/_lib/yii/yii-1.1.5.r2654/framework/web/CBaseController.php(165): TransactionController->createWidget()
#10 path-to/www/dev/project/yii/protected/modules/accounts/views/transaction/account.php(86): TransactionController->widget()
#11 path-to/www/_lib/yii/yii-1.1.5.r2654/framework/web/CBaseController.php(119): require()
#12 path-to/www/_lib/yii/yii-1.1.5.r2654/framework/web/CBaseController.php(88): TransactionController->renderInternal()
#13 path-to/www/_lib/yii/yii-1.1.5.r2654/framework/web/CController.php(833): TransactionController->renderFile()
#14 path-to/www/_lib/yii/yii-1.1.5.r2654/framework/web/CController.php(746): TransactionController->renderPartial()
#15 path-to/www/dev/project/yii/protected/modules/accounts/controllers/TransactionController.php(158): TransactionController->render()
#16 unknown(0): TransactionController->actionAccount()
#17 path-to/www/_lib/yii/yii-1.1.5.r2654/framework/web/actions/CInlineAction.php(54): ReflectionMethod->invokeArgs()
#18 path-to/www/_lib/yii/yii-1.1.5.r2654/framework/web/CController.php(300): CInlineAction->run()
#19 path-to/www/_lib/yii/yii-1.1.5.r2654/framework/web/filters/CFilterChain.php(133): TransactionController->runAction()
#20 path-to/www/_lib/yii/yii-1.1.5.r2654/framework/web/filters/CFilter.php(41): CFilterChain->run()
#21 path-to/www/_lib/yii/yii-1.1.5.r2654/framework/web/CController.php(1084): CAccessControlFilter->filter()
#22 path-to/www/_lib/yii/yii-1.1.5.r2654/framework/web/filters/CInlineFilter.php(59): TransactionController->filterAccessControl()
#23 path-to/www/_lib/yii/yii-1.1.5.r2654/framework/web/filters/CFilterChain.php(130): CInlineFilter->filter()
#24 path-to/www/_lib/yii/yii-1.1.5.r2654/framework/web/CController.php(283): CFilterChain->run()
#25 path-to/www/_lib/yii/yii-1.1.5.r2654/framework/web/CController.php(257): TransactionController->runActionWithFilters()
#26 path-to/www/_lib/yii/yii-1.1.5.r2654/framework/web/CWebApplication.php(324): TransactionController->run()
#27 path-to/www/_lib/yii/yii-1.1.5.r2654/framework/web/CWebApplication.php(121): CWebApplication->runController()
#28 path-to/www/_lib/yii/yii-1.1.5.r2654/framework/base/CApplication.php(135): CWebApplication->processRequest()
#29 path-to/www/dev/project/yii/web/index-dev.php(13): CWebApplication->run()
mdomba
(Maurizio Domba Cerin)
November 17, 2010, 8:46am
4
Can you post even the source code displayed above the stack trace?
iceblock
(Prettyscripts)
November 18, 2010, 11:45pm
5
Source File
/path-to/yii/yii-1.1.5.r2654/framework/YiiBase.php(395)
00383: * @return boolean whether the class has been loaded successfully
00384: */
00385: public static function autoload($className)
00386: {
00387: // use include so that the error PHP file may appear
00388: if(isset(self::$_coreClasses[$className]))
00389: include(YII_PATH.self::$_coreClasses[$className]);
00390: else if(isset(self::$classMap[$className]))
00391: include(self::$classMap[$className]);
00392: else
00393: {
00394: if(strpos($className,'\\')===false)
00395: include($className.'.php');
00396: else // class name with namespace in PHP 5.3
00397: {
00398: $namespace=str_replace('\\','.',ltrim($className,'\\'));
00399: if(($path=self::getPathOfAlias($namespace))!==false)
00400: include($path.'.php');
00401: else
00402: return false;
00403: }
00404: return class_exists($className,false) || interface_exists($className,false);
00405: }
00406: return true;
00407: }
Line 00395 was highlighted from the above code. Is this what you want?
mdomba
(Maurizio Domba Cerin)
November 19, 2010, 11:53am
6
I asked the code because in the stack trace it says [color="#880000 "]#3 YiiBase.php(391): autoload()[/color] … but in the code is [color="#8b0000 "]include(self::$classMap[$className]);[/color][color="#8b0000 "] [color="#000000 "]at that line…
[/color]
[color="#000000 "]I could not reproduce your error… the strange thing is that in your stack trace there is no CLinkColumn called…
If I rename CGridColumn so to get your error… I get a stack trace where CLinkColumn is called and only then I’m getting the error CGridColumn not found…[/color]
[/color][color="#000000 "]I’m testing this on windows… if you are using linux… check the case of the files… and the user properties…
I have no other clues…[/color]
iceblock
(Prettyscripts)
November 22, 2010, 4:22am
7
I’m running on linux and I’ve checked that the file case appears to be correct.
zaccaria
(Matteo Falsitta)
November 22, 2010, 7:07am
8
@iceblock , maybe you are using some older version of the framework?
Can you try to update and check if it solve the problem?
iceblock
(Prettyscripts)
December 16, 2010, 1:11am
9
zaccaria:
@iceblock , maybe you are using some older version of the framework?
Can you try to update and check if it solve the problem?
I’m using the latest version - V1.1.5.
mdomba
(Maurizio Domba Cerin)
December 17, 2010, 10:07am
10
I would suggest you to create a completely new Yii webapp… model… crud… and add only this link column…
just to check if it works… so you will see if it’s something in your current project or something with the system…