Archived
1
0
Fork 0

Fixing proper namespace for app/library

This commit is contained in:
Henrik Hautakoski 2018-04-02 02:28:25 +02:00
parent cb1e40ee0a
commit aa37d10024
22 changed files with 78 additions and 62 deletions

View file

@ -8,14 +8,14 @@ $loader = new \Phalcon\Loader();
$loader->registerDirs(
array(
$config->application->controllersDir,
$config->application->libraryDir,
$config->application->pluginsDir
)
)->register();
$loader->registerNamespaces(array(
'Model' => $config->application->modelsDir,
'Form' => $config->application->formsDir,
'Model' => $config->application->modelsDir,
'Form' => $config->application->formsDir,
'Httpcb' => $config->application->libraryDir,
));
require_once __DIR__ . '/../../vendor/autoload.php';

View file

@ -5,22 +5,29 @@
* @var \Phalcon\Config $config
*/
use Phalcon\Di\FactoryDefault;
use Phalcon\Mvc\View;
use Phalcon\Assets\Manager as AssetsManager;
use Phalcon\Mvc\Url as UrlResolver;
use Phalcon\Mvc\View\Engine\Volt as VoltEngine;
use Navigation\Navigation;
use Phalcon\Flash\Direct as FlashDirect;
use Phalcon\Mvc\Model\Metadata\Memory as MemoryMetaData;
use Phalcon\Mvc\Model\MetaData\Apc as ApcMetaData;
use Phalcon\Cache\Frontend\Data as FrontendDataCache;
use Phalcon\Cache\Backend\Apc as BackendApcCache;
use Phalcon\Translate\Adapter\NativeArray as TranslateAdapter;
use Phalcon\Logger;
use Phalcon\Logger\Adapter\Firephp as FirephpAdapter;
use Phalcon\Session\Adapter\Files as SessionAdapter;
use Phalcon\Mvc\Router;
use Phalcon\Di\FactoryDefault,
Phalcon\Mvc\View,
Phalcon\Assets\Manager as AssetsManager,
Phalcon\Mvc\Url as UrlResolver,
Phalcon\Mvc\View\Engine\Volt as VoltEngine,
Phalcon\Flash\Direct as FlashDirect,
Phalcon\Mvc\Model\Metadata\Memory as MemoryMetaData,
Phalcon\Mvc\Model\MetaData\Apc as ApcMetaData,
Phalcon\Cache\Frontend\Data as FrontendDataCache,
Phalcon\Cache\Backend\Apc as BackendApcCache,
Phalcon\Translate\Adapter\NativeArray as TranslateAdapter,
Phalcon\Logger,
Phalcon\Logger\Adapter\File as FileLogAdapter,
Phalcon\Session\Adapter\Files as SessionAdapter,
Phalcon\Mvc\Router;
use Httpcb\Auth,
Httpcb\OAuth,
Httpcb\Acl,
Httpcb\Navigation,
Httpcb\Menu;
/**
* The FactoryDefault Dependency Injector automatically register the right services providing a full stack framework
@ -33,7 +40,7 @@ $di = new FactoryDefault();
$di->setShared('logger', function() {
//return new Phalcon\Logger\Adapter\Firephp("");
return new Phalcon\Logger\Adapter\File(APP_PATH . "/app/log.txt");
return new FileLogAdapter(APP_PATH . "/app/log.txt");
});
$di->setShared('dispatcher', function() use ($di, $config) {
@ -119,7 +126,7 @@ $di->setShared('router', function() {
return $router;
});
$di->setShared('viewHelper', '\ViewHelper\Service');
$di->setShared('viewHelper', 'Httpcb\ViewHelper\Service');
/**
* Setting up the view component
@ -145,7 +152,7 @@ $di->setShared('view', function () use ($di, $config) {
// Register view helpers
$compiler = $volt->getCompiler();
$compiler->addExtension(new \ViewHelper\Volt\Extension($di));
$compiler->addExtension(new Httpcb\ViewHelper\Volt\Extension($di));
return $volt;
},
@ -274,12 +281,10 @@ $di->set('oauth', function() use ($config) {
});
$di->set('auth', function() use ($config) {
return new Auth\Auth($config);
return new Auth($config);
});
$di->set('acl', function() {
return new Acl\Acl();
});
$di->set('acl', 'Httpcb\Acl');
$di->set('menu', function() use ($di) {
@ -322,9 +327,9 @@ $di->set('menu', function() use ($di) {
$menu = new Menu($navigation);
$menu->setMenuClass(null);
if ($di->get('auth')->hasIdentity()) {
$menu->setAclRole(Acl\Acl::ROLE_USER);
$menu->setAclRole(Acl::ROLE_USER);
} else {
$menu->setAclRole(Acl\Acl::ROLE_GUEST);
$menu->setAclRole(Acl::ROLE_GUEST);
}
return $menu;
});