O'Reilly logo

Yii Project Blueprints by Charles R. Portwood II

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating the controller to manage users

Next, we'll need to implement the necessary methods to create and modify users within our application. Since our users table doesn't have any concept of roles yet, we'll manage our users from the command line through CConsoleCommand. This method will ensure that only authenticated users (users who have access to our server) can modify the user's information. In a real-world application, this functionality can be moved to a secured UsersController in our application.

Creating users

To start with our user management, create a new console command in protected/commands/UserCommand.php, and add the following:

<?php class UserCommand extends CConsoleCommand {}

The CConsoleCommand class is very similar to our controllers. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required