It depends what you want to do. For example if you want to create additional functionalities you have 2 options: add new code to User.php, or create new model and name is somehow else, and use that model in your code. If you do not like code from the User model then create the new one rewrite all functionalities, but in that case you are doing unecessary double work in my opinion.
I already have a table named USERS which has all rthe necessary columns abd it’s related to the others tables in the db (foreign key etc)
I’ve created the model and controllers for both tables (may table USERS and the default one created by yii USER) but is sims that by defautlt in SiteController.php LoginForm.php Login.php… it uses the one that the framework created USER (and it has no relation with the others table in the db)
But I want to use ny own table USERS
ps : this db is from my previous project that I want to upgrade and not created from scratch
Well just update code in those files from using User to user Users.
instead of:
use common\models\User
use:
use common\models\Users
if your Users model is located there…
And if you are in the common namespace ( like LoginForm.php ), you will have to dive in code and change User static calls to Users. You will have to update everything…
edit common/models/User.php
class User extends ActiveRecord implements IdentityInterface
{
...
public static function tableName()
{
return '{{%users}}'; // <- try modifying this line with your table name
}
...
}