Yii Framework Forum

Yii1 + 2 Combined Class CDataColumn.php not loading


(Scp) #1

I have a large existing Yii 1 app. I have integrated Yii2 into the app as per the guide for creating a custom combined Yii class. 99% of stuff seems to be working except that I keep getting a:


include(CDataColumn.php): failed to open stream: No such file or directory

error in a grid view display.

The trace is:


#0 /Users/Stephen/Sites/yii/framework/YiiBase.php(432): include()

#1 unknown(0): autoload()

#2 /Users/Stephen/Sites/yii/framework/zii/widgets/grid/CGridView.php(413): spl_autoload_call()

#3 /Users/Stephen/Sites/yii/framework/zii/widgets/grid/CGridView.php(383): CGridView->createDataColumn()

#4 /Users/Stephen/Sites/yii/framework/zii/widgets/grid/CGridView.php(359): CGridView->initColumns()

#5 /Users/Stephen/Sites/yii/framework/web/CBaseController.php(147): CGridView->init()

#6 /Users/Stephen/Sites/yii/framework/web/CBaseController.php(180): UserController->createWidget()

There is no change to the Zii/widgets/grid/ folder. Both CGridView.php and CDataColumn.php are present and in the same folder but it doesn’t seem to be autoloading the CDataColumn yet it knows about the CGridView.php

I have verified that CGridView.php still starts with:


<?php

/**

 * CGridView class file.

 *

 * @author Qiang Xue <qiang.xue@gmail.com>

 * @link http://www.yiiframework.com/

 * @copyright 2008-2013 Yii Software LLC

 * @license http://www.yiiframework.com/license/

 */


Yii::import('zii.widgets.CBaseListView');

Yii::import('zii.widgets.grid.CDataColumn');

Yii::import('zii.widgets.grid.CLinkColumn');

Yii::import('zii.widgets.grid.CButtonColumn');

Yii::import('zii.widgets.grid.CCheckBoxColumn');


(Robere Starkk) #2

I am experiencing this exact issue.
Did you ever discover a resolution?


(Scp) #3

I did not. Gave up on it. Sorry.


(Robere Starkk) #4

Hah no worries, thanks anyway.

I’ve bodged a solution where I know it can find them if they’re in the parent folder of the zii folder, so I’ve created symlinks like:
CDataColumn.php -> zii/widgets/grid/CDataColumn.php
for all the files in zii/widgets/grid (except CGridView.php which it can find just fine for some reason).


(Robere Starkk) #5

I’m sure a better way would be to add zii\widgets\grid to the php include_path, but I don’t know how to do that :stuck_out_tongue: