Example #1
0
 private static function initDoctrine()
 {
     App::$inst->container->singleton('DoctrineConfig', function () {
         $paths = array(APPLICATION_PATH . "/models/Entity");
         $isDevMode = false;
         $config = \Doctrine\ORM\Tools\Setup::createAnnotationMetadataConfiguration($paths, $isDevMode);
         if (isset(App::$inst->config['resources']['doctrine']['proxiesPath'])) {
             $config->setProxyDir(App::$inst->config['resources']['doctrine']['proxiesPath']);
         } elseif (IS_SAVVIS) {
             $config->setProxyDir(sprintf('/tmp/%s/proxies', App::$inst->config['resources']['doctrine']['dbal']['connection']['parameters']['dbname']));
         } else {
             $config->setProxyDir(APPLICATION_PATH . '/tmp/proxies');
         }
         $config->setProxyNamespace('Application\\tmp\\proxies');
         $config->setAutoGenerateProxyClasses(true);
         return $config;
     });
     App::$inst->container->singleton('em', function () {
         $config = App::$inst->DoctrineConfig;
         $entityManager = \Doctrine\ORM\EntityManager::create(App::$inst->config['resources']['doctrine']['dbal']['connection']['parameters'], $config);
         return $entityManager;
     });
     App::$inst->cache = Bootstrap::initDoctrineCache(App::$inst->DoctrineConfig);
     //init doctrine cache
 }
Example #2
0
 protected function setUp()
 {
     define('SERVER_SCRIPT', 'unittest');
     \Slim\Environment::mock();
     \Application\Bootstrap::init();
     \Library\SFacebook::init();
 }
Example #3
0
 /**
  * @param $auth
  * @return mixed
  */
 public function alreadyRegisteredLogic($auth)
 {
     $user = Users\Table::findRow($auth->userId);
     if ($user->status != Users\Table::STATUS_ACTIVE) {
         Messages::addError('User is not active');
     }
     $user->login();
     $this->response->redirectTo('index', 'index');
 }
 /**
  * @return void
  */
 public function dropDatabase()
 {
     $em = $this->getEntityManager();
     $queries = (include Bootstrap::getModulePath() . '/tests/data/test.data.php');
     arsort($queries);
     foreach ($queries as $query) {
         $em->getConnection()->exec($query['drop']);
     }
 }
Example #5
0
 /**
  * @param string $module
  * @param string $controller
  * @param array $params
  * @return \Bluz\Controller\Controller
  * @throws \Exception
  */
 public function dispatch($module, $controller, $params = array())
 {
     $this->dispatchModule = $module;
     $this->dispatchController = $controller;
     try {
         return parent::dispatch($module, $controller, $params);
     } catch (\Exception $e) {
         $this->setException($e);
         throw $e;
     }
 }
Example #6
0
<?php

use Application\App;
use Application\Controllers\Error;
error_reporting(E_ALL | E_STRICT);
require __DIR__ . '/../vendor/autoload.php';
try {
    $app = \Application\Bootstrap::init();
    $app->run();
} catch (\Exception $e) {
    if (!IS_PRODUCTION) {
        die($e->getMessage());
    } else {
        syslog(LOG_ERR, $e->getMessage());
        echo 'Sorry, something went wrong. We are working on this';
        die;
    }
}
Example #7
0
 /**
  * @param string $module
  * @param string $controller
  * @param array $params
  * @return \Bluz\View\View|string
  */
 public function dispatch($module, $controller, $params = array())
 {
     $this->dispatchModule = $module;
     $this->dispatchController = $controller;
     return parent::dispatch($module, $controller, $params);
 }
            } elseif (is_dir($vendorPath . '/ZF2/library')) {
                $zf2Path = $vendorPath . '/ZF2/library';
            } elseif (is_dir($vendorPath . '/zendframework/zendframework/library')) {
                $zf2Path = $vendorPath . '/zendframework/zendframework/library';
            }
        }
        if (!$zf2Path) {
            throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install` or define a ZF2_PATH environment variable.');
        }
        if (file_exists($vendorPath . '/autoload.php')) {
            include $vendorPath . '/autoload.php';
        }
        include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
        AutoloaderFactory::factory(array('Zend\\Loader\\StandardAutoloader' => array('autoregister_zf' => true, 'namespaces' => array(__NAMESPACE__ => __DIR__ . '/' . __NAMESPACE__))));
    }
    protected static function findParentPath($path)
    {
        $dir = __DIR__;
        $previousDir = '.';
        while (!is_dir($dir . '/' . $path)) {
            $dir = dirname($dir);
            if ($previousDir === $dir) {
                return false;
            }
            $previousDir = $dir;
        }
        return $dir . '/' . $path;
    }
}
Bootstrap::init();
Example #9
0
                $zf2Path = $vendorPath . '/ZF2/library';
            } elseif (is_dir($vendorPath . '/zendframework')) {
                $zf2Path = $vendorPath . '/zendframework';
            }
        }
        if (!$zf2Path) {
            throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install` or' . ' define a ZF2_PATH environment variable.');
        }
        if (file_exists($vendorPath . '/autoload.php')) {
            include $vendorPath . '/autoload.php';
        }
        include $zf2Path . '/zend-loader/src/AutoloaderFactory.php';
        AutoloaderFactory::factory(array('Zend\\Loader\\StandardAutoloader' => array('autoregister_zf' => true, 'namespaces' => array(__NAMESPACE__ => __DIR__ . '/' . __NAMESPACE__))));
    }
    protected static function findParentPath($path)
    {
        $dir = __DIR__;
        $previousDir = '.';
        while (!is_dir($dir . '/' . $path)) {
            $dir = dirname($dir);
            if ($previousDir === $dir) {
                return false;
            }
            $previousDir = $dir;
        }
        return $dir . '/' . $path;
    }
}
Bootstrap::init();
Bootstrap::chroot();
Example #10
0
<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
use application\Session;
use application\Bootstrap;
use application\Request;
require './vendor/autoload.php';
require 'config/config.php';
//require 'config/cli-config.php';
require './config/autoload.php';
require './config/Doctrine.php';
try {
    Session::iniciar();
    Bootstrap::run(new Request());
} catch (Exception $ex) {
    echo $ex->getMessage();
}