Beispiel #1
0
 public static function Config($prefix = "app_")
 {
     self::$config = new Doctrine\ORM\Configuration();
     // (2)
     // Proxy Configuration (3)
     self::$config->setProxyDir(__DIR__ . "/doctrine/proxy_cache");
     self::$config->setProxyNamespace(jf_Application_Name . '\\Proxies');
     self::$config->setAutoGenerateProxyClasses(jf::$RunMode->IsDevelop());
     // Mapping Configuration (4)
     //$driverImpl = new Doctrine\ORM\Mapping\Driver\XmlDriver(__DIR__."/entities/xml");
     //$driverImpl = new Doctrine\ORM\Mapping\Driver\XmlDriver(__DIR__."/config/mappings/yml");
     $driverImpl = self::$config->newDefaultAnnotationDriver(__DIR__ . "/../model");
     self::$config->setMetadataDriverImpl($driverImpl);
     // Caching Configuration (5)
     if (jf::$RunMode->IsDeploy() and function_exists("apc_exists")) {
         self::$cache = new \Doctrine\Common\Cache\ApcCache();
     } else {
         self::$cache = new \Doctrine\Common\Cache\ArrayCache();
     }
     self::$config->setMetadataCacheImpl(self::$cache);
     self::$config->setQueryCacheImpl(self::$cache);
     // database configuration parameters (6)
     $db = \jf\DatabaseManager::Configuration();
     $adapter = $db->Adapter;
     if ($adapter == "mysql" or $adapter == "mysqli" or !$adapter) {
         $adapter = "pdo_mysql";
     }
     $conn = array('driver' => $adapter, 'user' => $db->Username, 'password' => $db->Password, 'host' => $db->Host, 'dbname' => $db->DatabaseName, 'charset' => 'utf8', 'path' => $db->DatabaseName);
     require_once __DIR__ . "/doctrine/sqllogger.php";
     self::$config->setSQLLogger(new Doctrine\DBAL\Logging\jframeworkSQLLogger());
     // obtaining the entity manager (7)
     self::$eventManager = new Doctrine\Common\EventManager();
     self::$tablePrefix = new \Doctrine\Extensions\TablePrefix($prefix);
     self::$eventManager->addEventListener(\Doctrine\ORM\Events::loadClassMetadata, self::$tablePrefix);
     self::$entityManager = \Doctrine\ORM\EntityManager::create($conn, self::$config, self::$eventManager);
 }
Beispiel #2
0
<?php

####################################################################################
# add any more configuration you need for your application here, examples provided #
####################################################################################
//Path to lessons directory
define('LESSON_PATH', dirname(__FILE__) . "/../../challenges/single/");
define('CONTEST_CHALLENGE_PATH', dirname(__FILE__) . "/../../challenges/contest/");
//URL of lessons
define('SINGLE_MODE_LESSON_URL', jf::url() . "/mode/single/challenges/");
define('WORKSHOP_MODE_LESSON_URL', jf::url() . "/mode/workshop/challenges/");
define('WORKSHOP_ADMIN_URL', jf::url() . "/mode/workshop/admin");
define('CONTEST_MODE_DIR', jf::url() . "/mode/contest/");
// Notice the trailing slash
define('CONTEST_MODE_HOME', CONTEST_MODE_DIR . "home");
define('CONTEST_ADMIN_URL', CONTEST_MODE_DIR . "admin");
define('CONTEST_MODE_LESSON_URL', CONTEST_MODE_DIR . "challenges/");
// GitHub URL
define('GITHUB_URL', 'https://github.com/shivamdixit/WebGoatPHP/');
//Add autoload rules
#\jf\Autoload::AddRuleArray(array("Classname"=>jf::root()."/app/model/filepath.php"));
DoctrinePlugin::Load();