protected function getMysqlSqlMapManager() { static $conn; static $sqlMapManager; if (Prado::getApplication() === null) { Prado::setApplication(new TApplication(dirname(__FILE__) . '/app')); } if ($conn === null) { $conn = new TDbConnection('mysql:host=localhost;dbname=prado_system_data_sqlmap', 'prado_unitest', 'prado_system_data_sqlmap_unitest'); } $conn->setActive(true); if ($sqlMapManager === null) { $sqlMapManager = new TSqlMapManager($conn); $sqlMapManager->configureXml(dirname(__FILE__) . '/DynamicParameterTestMap.xml'); } return $sqlMapManager; }
public function __construct($basePath = 'protected', $cacheConfig = true, $configType = self::CONFIG_TYPE_XML) { Prado::setApplication($this); $this->setConfigurationType($configType); $this->resolvePaths($basePath); if ($cacheConfig) { $this->_cacheFile = $this->_runtimePath . DIRECTORY_SEPARATOR . self::CONFIGCACHE_FILE; } $this->_uniqueID = md5($this->_runtimePath); $this->_parameters = new TMap(); $this->_services = array($this->getPageServiceID() => array('TPageService', array(), null)); Prado::setPathOfAlias('Application', $this->_basePath); }
/** * Constructor. * Sets application base path and initializes the application singleton. * Application base path refers to the root directory storing application * data and code not directly accessible by Web users. * By default, the base path is assumed to be the <b>protected</b> * directory under the directory containing the current running script. * @param string application base path or configuration file path. * If the parameter is a file, it is assumed to be the application * configuration file, and the directory containing the file is treated * as the application base path. * If it is a directory, it is assumed to be the application base path, * and within that directory, a file named <b>application.xml</b> * will be looked for. If found, the file is considered as the application * configuration file. * @param boolean whether to cache application configuration. Defaults to true. * @throws TConfigurationException if configuration file cannot be read or the runtime path is invalid. */ public function __construct($basePath = 'protected', $cacheConfig = true) { // register application as a singleton Prado::setApplication($this); $this->resolvePaths($basePath); if ($cacheConfig) { $this->_cacheFile = $this->_runtimePath . DIRECTORY_SEPARATOR . self::CONFIGCACHE_FILE; } // generates unique ID by hashing the runtime path $this->_uniqueID = md5($this->_runtimePath); $this->_parameters = new TMap(); $this->_services = array($this->getPageServiceID() => array('TPageService', array(), null)); Prado::setPathOfAlias('Application', $this->_basePath); }