I have Registration model(which has fields login, password, email, mobile) and want to use some of the fields from Registration(like login and password) in a login action, and also validate it. How can i reuse the model fields, and also Validate the fields based on Scenario.
How to reuse Yii form using scenario
1.8k Views Asked by Harish Kurup At
2
There are 2 best solutions below
0

It is better to use a user module.
This is an example of the directory structure of a user module:
protected/modules/user/
controllers/
LoginController.php
LogoutController.php
RegisterController.php
...
models/
Login.php
Register.php
...
views/
user/
login.php
register.php
...
The directory structure of yii-user might be useful.
i think you can reuse form model and can write custom validation rules in the form and for each action. for example. hari you just give a try like this...
Controller part:
have a nice day!!!