I have created a User model class and CRUD functionality by using Gii, and it is working fine.
Now I am kind a lost here, I want to save some information to User table from another controller.
In my TestController.php, I have a method testMethod() from which I want to save information to User table.
class TestController extends Controller
{
public function testMethod()
{
$firstName = 'abc';
$lastName = 'xyz';
$email = 'test@test.com';
// save it to User's table in database
}
I have checked the UserController.php class, but it simply calls the save() method.
save is a method of User (inheriting from CActiveRecord) - so, create a new instance of User, initialize the variables you have defined, and use the power of activerecord to save it to the db ($user->save()).