public static function ListAllSources()
{
$logger = \Swiftriver\Core\Setup::GetLogger();
$logger->log("Core::Modules::DataContext::MySQL_V2::DataContext::ListAllSources [Method initiated]", \PEAR_LOG_DEBUG);
$sources = array();
$selectAllSourcesSql = "CALL SC_SelectAllSources ()";
try {
$db = self::PDOConnection();
$selectAllSourcesStatment = $db->prepare($selectAllSourcesSql);
$result = $selectAllSourcesStatment->execute();
if ($result === false) {
$logger->log("Core::Modules::DataContext::MySQL_V2::DataContext::ListAllSources [An Exception was thrown by the PDO framwork]", \PEAR_LOG_ERR);
$errorInfo = $selectAllSourcesStatment->errorInfo();
$errorMessage = $errorInfo[2];
$logger->log("Core::Modules::DataContext::MySQL_V2::DataContext::ListAllSources [{$errorMessage}]", \PEAR_LOG_ERR);
}
$logger->log("Core::Modules::DataContext::MySQL_V2::DataContext::ListAllSources [END: Executing PDO statement]", \PEAR_LOG_DEBUG);
foreach ($selectAllSourcesStatment->fetchAll() as $row) {
$logger->log("Core::Modules::DataContext::MySQL_V2::DataContext::ListAllSources [START: Constructing source obejct]", \PEAR_LOG_DEBUG);
$json = $row["json"];
$source = \Swiftriver\Core\ObjectModel\ObjectFactories\SourceFactory::CreateSourceFromJSON($json);
$sources[] = $source;
$logger->log("Core::Modules::DataContext::MySQL_V2::DataContext::ListAllSources [END: Constructing source obejct]", \PEAR_LOG_DEBUG);
}
$db = null;
} catch (\PDOException $e) {
$logger->log("Core::Modules::DataContext::MySQL_V2::DataContext::ListAllSources [An Exception was thrown:]", \PEAR_LOG_ERR);
$logger->log("Core::Modules::DataContext::MySQL_V2::DataContext::ListAllSources [{$e}]", \PEAR_LOG_ERR);
}
$logger->log("Core::Modules::DataContext::MySQL_V2::DataContext::ListAllSources [Method finished]", \PEAR_LOG_DEBUG);
return $sources;
}