Archived
1
0
Fork 0
This repository has been archived on 2026-04-03. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
httpcb/app/modules/Base.php
2023-04-30 16:52:38 +02:00

46 lines
1 KiB
PHP

<?php
namespace App\Module;
use Phalcon\Loader,
Phalcon\Di\DiInterface,
Phalcon\Mvc\Dispatcher,
Phalcon\Mvc\ModuleDefinitionInterface;
abstract class Base implements ModuleDefinitionInterface
{
protected $_controllerPath;
protected $_controllerNamespace;
protected $_viewDir;
/**
* Register a specific autoloader for the module
*/
public function registerAutoloaders(DiInterface $di = null)
{
$loader = new Loader();
$loader->registerNamespaces([
$this->_controllerNamespace => $this->_controllerPath,
]);
$loader->register();
}
/**
* Register specific services for the module
*/
public function registerServices(DiInterface $di)
{
$dispatcher = $di->get('dispatcher');
$dispatcher->setDefaultNamespace($this->_controllerNamespace);
$di->get('view')->setViewsDir(array_merge(
[$this->_viewDir],
(array) $di->get('view')->getViewsDir()
));
}
}