本文整理汇总了PHP中Prado::setApplication方法的典型用法代码示例。如果您正苦于以下问题:PHP Prado::setApplication方法的具体用法?PHP Prado::setApplication怎么用?PHP Prado::setApplication使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Prado
的用法示例。
在下文中一共展示了Prado::setApplication方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMysqlSqlMapManager
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;
}
示例2: __construct
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);
}
示例3: __construct
/**
* 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);
}