Yii custom model path. For example, there are two Yii projects, test1 and test2. In test1, there is already a model. test2 calls the model in test1 directly. In fact, it adds an alias and modifies the configuration. for example, there are two Yii projects, test1 and test2.
The model already exists in test1. test2 calls the model in test1 directly. In fact, add an alias and modify the configuration.
First, add:
Yii: setPathOfAlias ('pubmodels', dirname (_ FILE _). '/../test1/protected/models ');
Set the path of your project as needed.
Open the configuration file main. php and add
'Import' => array ('application. models. * ', 'pubmodels. *', // This is the test1 model 'application. components .*',)
If you do not need the model of the current project, comment out 'application. models.
In this way, you can share a model.
If you use giix, you can also use this method to call the same extension, language pack, and so on. you can set aliases and share the call.
The policyii project is test1 and test2. The model already exists in test1. test2 calls the model in test1 directly. In fact, it adds an alias and modifies the configuration...