In the Yii Cookbook one can read:
"In Yii, you can create reusable controllers. If you are creating a lot of applications or
controllers that are of the same type, moving all common code into a reusable controller
will save you a lot of time.
In this recipe, we will create a simple reusable api controller that will implement a simple
JSON CRUD API for a model. It will take input data from POST and GET and will respond with
JSON data and a corresponding HTTP response code."
And then there is a code for this controller and then:
"Now we need to connect it to our application via protected/config/main.php.
It can be done by adding controller configuration to the controllerMap property of
CWebApplication so we need to place the following right after the configuration
array opening:
…
'controllerMap' => array(
'api' => array(
'class' => 'ext.json_api.JsonApiController',
'modelName' => 'Post',
),
),
"
But I can’t find a way of how to use it. I also don’t know how to attach it to more than just one model. Can somebody explain?