I have the following directory structure:
modules/
api/
controllers/
ApiController.php
InventoryController.php
OtherController.php
The init() method is common amongst multiple Controllers so I want to refactor that into a parent Controller class such as:
class Api_ApiController extends Zend_Controller_Action
{
public function init()
{
// common code
}
}
When I try:
class Api_InventoryController extends Api_ApiController
I get:
Fatal error: Class 'Api_ApiController' not found in /application/modules/api/controllers/InventoryController.php on line 4
Why does Zend Framework not map Api_ApiController to modules/api/controllers/ApiController.php?
I have figure out a way around this by putting the ApiController in the library/ and registering the namespace but it seems like a hack to me.