I want to write a simple rpg.

I use yii 2 user, which on the move creates 7 tables.

while all this in the user module

I want to throw the game in modules \ game

logically, you could have 2 bases - for the game and for the user, but then the foreign keys will not work.

how to be? Is it possible to forward communication between modules? or just create a my_user model in the module and, at the first registration, create an entry for the user with his id and name?

How is this correctly implemented?

  • For example, in a game , a getter is written in the desired model of the model. public function getUser() { return $this->hasOne('app\modules\users\models\User', array('id' => 'user_id')); } public function getUser() { return $this->hasOne('app\modules\users\models\User', array('id' => 'user_id')); } ... since in the second connection, yii are made as setters and getters ... look here, the same person says: habrahabr.ru/post/185236 - Alexey Shimansky

1 answer 1

Using the override of the getDb method of the getDb object, you can select the component that will be used to connect to the database. Accordingly, relays will work fine for you.

I advise you to use one DB and either inherit from the component and expand it, or refuse and make the implementation exclusively for your needs.