Yii 1 module inside yii 2 application

Hey all,

I have a Yii 1 application with 5 modules and we want to start building new applications/modules using Yii 2. Migrating the existing Yii 1 application and modules to Yii 2 is not an option, it will takes time. But we want to start new modules/applications using Yii 2.

The Yii 1 application has a layout and a security module with some controllers/models and filters for doing authentication and authorization. The new Yii 2 application will be doing a SSO (using the cookie approach) with the Yii 1 application.

However, the issue I have right now is, how to deal with the security module. I don’t want to duplicate that code generating it in Yii 2, specially the model classes that map to my security database schema. What options do I have? Can I somehow reuse the security Yii 1 module in the Yii 2 application ?

Thanks for your advise.

Hi,

Have you seen this already?

Maybe worth a try in your situation:

http://www.yiiframework.com/doc-2.0/guide-tutorial-yii-integration.html#using-yii-2-with-yii-1

If that does not work I have no good suggests, sorry.

Best Regards

Did you get anywhere with this?

I’ve got a Yii 1 application with 19 modules in it. I started development on it a year before Yii 2 was finally released. It became obsolete before it was even really established.

I want to start moving to Yii 2 (before Yii 1 becomes unsafe) so was looking at the advice that says add new features using Yii 2, inside your Yii 1 app. The only problem is, it just mentions how to load Yii 2 classes, and nothing else. How do you handle routing? Authentication? Relations between existing Yii 1 models and Yii 2 ones? Configuration? Anything other than loading a few models?

It still looks like I’d have to rebuild half my application from scratch just to make a single Yii 2 module.

Anyone got any examples?