yiisoft / yii2-redis

Yii 2 Redis extension.
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
452 stars 183 forks source link

Resolve connection with Instance::ensure #196

Closed AlikDex closed 4 years ago

AlikDex commented 4 years ago
Q A
Is bugfix? no
New feature? no
Breaks BC? no
Tests pass? yes
Fixed issues #195
samdark commented 4 years ago

@AlikDex, @rob006 is there a way to fix it in a backwards compatible manner?

rob006 commented 4 years ago

IMO changes in ActiveRecord are unnecessary. This how it works for other AR implementations - if you want different component/approach to be used for connection, you should override getDb() in your model. Changing this will only create inconsistency.

samdark commented 4 years ago

Yes. Agree.

rob006 commented 4 years ago

@samdark It is still worth to simplify Session::init() by using Instance::ensure() for initialization of redis property. It will be more consistent, simplify implementation and make configuration more flexible.

samdark commented 4 years ago

@rob006 since you're on it, how about a pull request?