本文整理汇总了PHP中Swiftriver\Core\Setup::DALConfiguration方法的典型用法代码示例。如果您正苦于以下问题:PHP Setup::DALConfiguration方法的具体用法?PHP Setup::DALConfiguration怎么用?PHP Setup::DALConfiguration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Swiftriver\Core\Setup
的用法示例。
在下文中一共展示了Setup::DALConfiguration方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* The constructor for this repository
* Accepts the fully qulaified type of the IContentDataContext implemting
* data context for this repository
*
* @param string $dataContext
*/
public function __construct($dataContext = null)
{
if (!isset($dataContext)) {
$dataContext = \Swiftriver\Core\Setup::DALConfiguration()->DataContextType;
}
$classType = (string) $dataContext;
$this->dataContext = new $classType();
}
示例2: __construct
/**
* The constructor for this repository
* Accepts the fully qulaified type of the IAPIKeyDataContext implemting
* data context for this repository
*
* @param string $dataContext
*/
public function __construct($dataContext = null)
{
//if the data context is null ten set it to the one in config
if (!isset($dataContext)) {
$dataContext = \Swiftriver\Core\Setup::DALConfiguration()->DataContextType;
}
$classType = (string) $dataContext;
$this->dataContext = new $classType();
}
示例3: RunGenericQuery
/**
* This function should allow calling classes to run basic sql select
* statements and switch the implmentation based on the data content
* type.
*
* @param string $sql
* @return array["results","errors"]
*/
public function RunGenericQuery($sql)
{
$dataContext = \Swiftriver\Core\Setup::DALConfiguration()->DataContextType;
switch ($dataContext) {
case "\\Swiftriver\\Core\\Modules\\DataContext\\MySql_V2\\DataContext":
$db = \Swiftriver\Core\Modules\DataContext\MySql_V2\DataContext::PDOConnection();
$statement = $db->prepare($sql);
$result = $statement->execute();
return $result == false ? array("results" => array(), "errors" => $statement->errorInfo()) : array("results" => $statement->fetchAll(), "errors" => null);
}
}
示例4: RunAnalyticsRequest
/**
* Function that takes in an instance of the AnalyticsRequest object
* and attempts to match this to an instance of the IAnalyticsProvider
* interface.
*
* @param AnalyticsRequest $request
* @return AnalyticsRequest
*/
public function RunAnalyticsRequest($request)
{
$logger = \Swiftriver\Core\Setup::GetLogger();
$logger->log("Core::Analytics::AnalyticsEngine::__construct [Method invoked]", \PEAR_LOG_DEBUG);
if ($request == null) {
$logger->log("Core::Analytics::AnalyticsEngine::__construct [The request parameter was null]", \PEAR_LOG_DEBUG);
$logger->log("Core::Analytics::AnalyticsEngine::__construct [Method finished]", \PEAR_LOG_DEBUG);
return $request;
}
$dataContextType = \Swiftriver\Core\Setup::DALConfiguration()->DataContextType;
$request->DataContextType = $dataContextType;
$providerType = $request->RequestType;
$logger->log("Core::Analytics::AnalyticsEngine::__construct [START: Looking for matching provider]", \PEAR_LOG_DEBUG);
foreach ($this->analyticsProviders as $analyticsProvider) {
if ($providerType != $analyticsProvider->ProviderType()) {
continue;
}
try {
$logger->log("Core::Analytics::AnalyticsEngine::__construct [START: Running provider]", \PEAR_LOG_DEBUG);
$return = $analyticsProvider->ProvideAnalytics($request);
$logger->log("Core::Analytics::AnalyticsEngine::__construct [END: Running provider]", \PEAR_LOG_DEBUG);
$logger->log("Core::Analytics::AnalyticsEngine::__construct [Method finished]", \PEAR_LOG_DEBUG);
return $return;
} catch (\Exception $e) {
$logger->log("Core::Analytics::AnalyticsEngine::__construct [An exception was thrown]", \PEAR_LOG_ERR);
$logger->log("Core::Analytics::AnalyticsEngine::__construct [{$e}]", \PEAR_LOG_ERR);
$logger->log("Core::Analytics::AnalyticsEngine::__construct [Method finished]", \PEAR_LOG_DEBUG);
return $request;
}
}
$logger->log("Core::Analytics::AnalyticsEngine::__construct [END: Looking for matching provider - No Provider found for {$providerType}]", \PEAR_LOG_ERR);
$logger->log("Core::Analytics::AnalyticsEngine::__construct [Method finished]", \PEAR_LOG_DEBUG);
return $request;
}