After reviewing the comments by @cvsguimaraes and @NikolaosDimoploulos I took the option to "start again". I used the phalcon devtools to generate the basis of the structure using the apps option.
Based on this I was then able to "build" the structure up from there.
In order to have the inheritance I was after this is what I ended up with:
#File: apps/crm/controllers/ClientsController.php
namespace myApp\CRM\Controllers
class ClientsController extends ControllerBase {...}
#File: apps/crm/controllers/ControllerBase.php
namespace myApp\CRM\Controllers
class ControllerBase extends \myApp\common\Controllers\FrontendBase {...}
#File: common/controllers/FrontendBase.php
namespace myApp\common\Controllers
class FrontendBase extends \myApp\common\Controllers\MasterBase {...}
#File: common/controllers/MasterBase.php
namespace myApp\common\Controllers
class MasterBase extends \Phalcon\Mvc\Controller {...}
Then in the file: apps/crm/Module.php I have the following:
namespace myApp\CRM;
class Module implements ModuleDefinitionInterface
{
public function registerAutoloaders()
{
$loader = new Loader();
$loader->registerNamespaces(array(
'myApp\CRM\Controllers' => __DIR__ . '/controllers',
'myApp\CRM\Models' => __DIR__ . '/models',
'myApp\common\Controllers' => __DIR__ . '/../../common/Controllers',
'myApp\common\Models' => __DIR__ . '/../../common/Models'
));
$loader->register();
}
}
This then works as you would expect. You can have functions in the MasterBase that you can call from the higher levels and you can also run functions such as adding css and JS to the output at the different levels, allowing you to separate out the control as you need.