Hi All,
I am following the instructions how to use yii2 in yii1.
Throws:
yii\base\ErrorException
include(Escaper.php): failed to open stream: No such file or directory
Do you have any idea what I am missing ?
Thanks
Hi All,
I am following the instructions how to use yii2 in yii1.
Throws:
include(Escaper.php): failed to open stream: No such file or directory
Do you have any idea what I am missing ?
Thanks
These two lines have to be added
spl_autoload_unregister(array('YiiBase','autoload'));
spl_autoload_register(array('Yii','autoload'));
So the file looks like
$yii2path = 'vendor/yiisoft/yii2/';
require $yii2path . '/BaseYii.php'; // Yii 2.x
$yii1path = 'vendor/yiisoft/yii/framework';
require $yii1path . '/YiiBase.php'; // Yii 1.x
class Yii extends \yii\BaseYii{...}
spl_autoload_unregister(array('YiiBase','autoload'));
spl_autoload_register(array('Yii','autoload'));
Yii::$classMap = include($yii2path . '/classes.php');
// register Yii 2 autoloader via Yii 1
Yii::registerAutoloader(['yii\BaseYii', 'autoload']);
// create the dependency injection container
Yii::$container = new yii\di\Container;