public static function go($config) { self::$core = new \ArrayObject(); self::$core->db = $config['db']['class']::getInstance()->connect($config['db']); self::$core->request = RequestFactory::create($config['data-type']); self::$core->response = ResponseFactory::create($config['data-type']); if ($config['cache']['on']) { self::$core->cache = $config['cache']['class']::getInstance()->create($config['cache']); } $controller = new Controller(); $controller->doAction('index'); }
public function __construct() { parent::__construct(); // $this->directory = $this->app->router()->getCurrentRoute()->getName(); $this->directory = 'news'; $this->entityManager = new EntityManager($this->directory); }
public function doTask() { parent::doTask(); $input = $this->getInput(); if ($input->getAsString('doSomething') == true) { $this->doSomething(); } }
public function doTask() { parent::doTask(); $hints = $this->getHints(); if ($hints->get('doLoad')) { $this->doLoad(); } }
protected function initTwig() { $this->twig()->addGlobal('AdminLTEPlugins', $this->AdminLTEPlugins); $this->twig()->addGlobal('left_menu_items', $this->getLeftMenuItems()); $this->twig()->addGlobal('cancel_route', $this->cancel_route); $logged_user = $this->app['security.token_storage']->getToken()->getUser(); $this->twig()->addGlobal('logged_user', $logged_user); parent::initTwig(); }
/** * @access public * * * @importante metodo @Core contem include as principais class dos sistema * * @param array() $main * * */ public static function begin($main) { define('DSN', $main['config']['db']['dsn']); ActiveRecord\Config::initialize(function ($cfg) { // $cfg->set_model_directory(MODEL); $cfg->set_connections(array('development' => DSN)); }); date_default_timezone_set($main['config']['timezone']); Controller::begin($main)->load(); }
/** * @param array $aOptions * @return int The exit status code. */ public static function go(array $aOptions = []) { $exitCode = 1; try { //register the composer autoloader require_once $aOptions['projectPackageFilePath'] . '/vendor/autoload.php'; $autoloader = new \Composer\Autoload\ClassLoader(); $autoloader->addPsr4('App\\', realpath($aOptions['appPackageFilePath'] . '/App')); $autoloader->register(); //boot the environment \App\Environment::init(['projectPackageFilePath' => $aOptions['projectPackageFilePath'], 'appPackageFilePath' => $aOptions['appPackageFilePath']]); //boot the controller $exitCode = \App\Controller::bootstrap(); } catch (Throwable $e) { error_log($e); } return $exitCode; }
public function doTask() { parent::doTask(); $model = $this->getModel(); $errorInfo = ['message' => null, 'details' => null, 'httpStatus' => null]; //get the exception hinted from ::handleException() $originalError = $this->getHints()->get('app.errorState.error'); if ($originalError) { if (\App\DEBUG) { $errorInfo['details'] = (string) $originalError; } //resolve the message if ($originalError instanceof UserFriendlyException) { /** @var UserFriendlyExceptionInterface $originalError */ $errorInfo['message'] = $originalError->getUserFriendlyMessage(); } else { if ($originalError instanceof UnresolvedRouteException) { $errorInfo['message'] = "The resource could not be found."; } } //resolve the https status if ($originalError instanceof HttpExceptionInterface) { /** @var HttpExceptionInterface $originalError */ $errorInfo['httpStatus'] = $originalError->getHttpStatusCode(); } else { if ($originalError instanceof UnresolvedRouteException) { $errorInfo['httpStatus'] = 404; } } } if (!$errorInfo['message']) { $errorInfo['message'] = 'An error has occurred.'; } if (!$errorInfo['httpStatus']) { $errorInfo['httpStatus'] = 500; } $model->set('errorInfo', $errorInfo); header(HttpUtils::createStatusHeader($errorInfo['httpStatus'])); }
function __construct() { parent::__construct(); }
public function __construct() { parent::__construct(); $this->connect = Database::getConnect('master'); }