Search code examples
phpyiiyii-extensions

Using models in third-party extensions


I'm using a third-party extension in Yii and I'd like to know, if it's possible to use the models in the extension.

The extension create a table on my database and the model has a relation rule to my user table. I have added a relation on my user model to the extension's model.

When I do a findAll query, it throws me an error: include(ExtensionModel.php): failed to open stream: No such file or directory.

How do I use models in third-party extensions?


Solution

  • Please have a look at the manual. In the simple case you only need to include this into the 3rd party files:

    require_once('path/to/yii.php');
    Yii::createWebApplication('path/to/config.php');