Hello All
I am trying to create a module in my yii based app and due to clash in class names I need to use namespaces. The problem is I am constantly facing the
Unable to resolve the request "payroll/department/create".
My directory structure is as follows
protected/modules/payroll
PayrollModule.php
protected/modules/payroll.controllers
DepartmentController.php
TaskController.php
protected/modules/payroll/models
Department.php
Task.php
the initial lines of all files are
PayrollModule.php
namespace payroll;
class PayrollModule extends \CWebModule {
404
It seems you have routing problems.
Check that your namespace Is correctly registered.
Check that your controller is correctly registered.
Then check the create action with no code. Just return simple text.
OK, the problem is resolved now.
The main thing in this regard is to have a controller map in PayrollModule.php public $controllerMap = array( 'task' => '\payroll\controllers\TaskCotnroller', 'commission' => '\payroll\controllers\CommissionController', 'department' => '\payroll\controllers\DepartmentController', 'employee' => '\payroll\controllers\EmployeeController', 'employeeCommission' => '\payroll\controllers\EmployeeCommissionController', 'employeeToCustomer' => '\payroll\controllers\EmployeeToCustomerController', 'employeeToStore' => '\payroll\controllers\EmployeeToStoreController', 'increment' => '\payroll\controllers\IncrementController', 'salary' => '\payroll\controllers\SalaryController', 'taskAssignment' => '\payroll\controllers\TaskAssignmentController', 'task' => '\payroll\controllers\TaskController', );