I am trying to write a custom extension for yii framework and I cannot access controller which is stored in extensions/controllers folder. I have searched a lot but I did not find any hint for that. This is the structure
protected
-- extensions
-- XYZ (Extension's name)
-- assets
-- controllers
-- XYZController.php
-- models
-- XYZModel.php
-- widgets
-- views
-- form.php
-- XYZWidget.php
I have done all adjustments needed to load extension and currently I am able to display the the form from a views folder by using $this->renderInternal('views/form.php'). So the extension is loaded successfully. The problem appears when I try to access controller inside extensions folder.
Usually when one need to access for example index method inside protected/controllers/SiteController.php then the URL is http://project.com/index.php/site/index" Therefore, what should I write in form action in order to access any method in /extensions/controllers/XYZController.php from a form.
I added this chunk of code in main.php like it was written in various recommendations
'controllerMap'=>array(
'XYZ'=>array(
'class'=> 'XYZ.controllers.XYZController',
),
),
config/main.php file
Yii::setPathOfAlias('XYZPath', realpath('protected') . '/extensions/AQ');
return array(
-------
-------
'preload'=>array('log', 'XYZ'),
// autoloading model and component classes
'import'=>array(
'application.models.*',
'application.components.*',
'application.extensions.XYZ.controllers.*',
'application.extensions.XYZ.models.*',
'application.extensions.XYZ.widgets.*',
),
'controllerMap'=>array(
'XYZ'=>array(
//'class'=> 'XYZPath.controllers.XYZController',
'class'=> 'extensions/XYZ/controllers/XYZController',
),
),
-------------
-------------
)
Kindly asking to give me any hint in this situaion. Thanks in advance.