Removing deprecated references and files

This commit is contained in:
Fernando Ontiveros
2025-04-02 00:00:00 +00:00
parent 884e67f883
commit d3bd0fcfbc
117 changed files with 40 additions and 14127 deletions

View File

@@ -1,489 +0,0 @@
<?php
use ProcessMaker\Core\System;
use ProcessMaker\Plugins\PluginRegistry;
require_once 'classes/model/om/BaseAddonsManager.php';
if (!defined("BUFSIZE")) {
define("BUFSIZE", 16384);
}
/**
* Skeleton subclass for representing a row from the 'UPGRADE_MANAGER' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package classes.model
*/
class AddonsManager extends BaseAddonsManager
{
/**
* Returns the download filename
*
* @return string download filename
*/
public function getDownloadFilename()
{
$filename = $this->getAddonDownloadFilename();
if (!isset($filename) || empty($filename)) {
$filename = "download.tar";
}
$dir = $this->getDownloadDirectory();
return "$dir/$filename";
}
public function getDownloadDirectory()
{
$dir = PATH_DATA . "upgrade/{$this->getStoreId()}_{$this->getAddonName()}";
if (!file_exists($dir)) {
mkdir($dir, 0777, true);
}
return ($dir);
}
/**
* Check to see if the download file exists and has the right data.
*
* @return mixed true if exists and md5 is good, false otherwise. Returns null
* if file exists but md5 for the download is not available.
*/
public function checkDownload()
{
$filename = $this->getDownloadFilename();
if (!file_exists($filename)) {
return false;
}
$download_md5 = $this->getAddonDownloadMd5();
if ($download_md5 == null) {
return null;
}
return (strcasecmp(G::encryptFileOld($filename), $download_md5) == 0);
}
/**
* Returns if this addon is of type 'plugin'
*
* @return bool true if is of type 'plugin', false otherwise
*/
public function isPlugin()
{
return ($this->getAddonType() == 'plugin');
}
/**
* Returns if this addon is of type 'core'
*
* @return bool true if is of type 'core', false otherwise
*/
public function isCore()
{
return ($this->getAddonType() == 'core');
}
/**
* Returns if this addon is installed or not-
*
* @return bool true if installed, false otherwise
*/
public function isInstalled()
{
if ($this->isCore()) {
return ($this->getAddonVersion() == $this->getInstalledVersion());
} elseif ($this->isPlugin()) {
return (file_exists(PATH_PLUGINS . "{$this->getAddonName()}.php"));
} else {
throw new Exception("Addon type '{$this->getAddonType()}' unsupported");
}
}
/**
* Returns if this addon is enabled or not.
*
* @return bool true if enabled, false otherwise
*/
public function isEnabled()
{
if ($this->isCore()) {
return $this->isInstalled();
} elseif ($this->isPlugin()) {
if (!$this->isInstalled()) {
return false;
}
$oPluginRegistry = PluginRegistry::loadSingleton();
return $oPluginRegistry->isEnable($this->getAddonName());
} else {
throw new Exception("Addon type '{$this->getAddonType()}' unsupported");
}
}
public function setEnabled($enable = true)
{
if (!$this->isInstalled() || !$this->isPlugin()) {
return false;
}
if ($this->getAddonName() == "enterprise") {
return false;
}
$oPluginRegistry = PluginRegistry::loadSingleton();
$filter = new InputFilter();
$requiredPath = PATH_PLUGINS . $this->getAddonName() . ".php";
$requiredPath = $filter->validateInput($requiredPath, 'path');
require_once($requiredPath);
if ($enable) {
$oPluginRegistry->enablePlugin($this->getAddonName());
$oPluginRegistry->setupPlugins(); //get and setup enabled plugins
} else {
$oPluginRegistry->disablePlugin($this->getAddonName());
}
$oPluginRegistry->savePlugin($this->getAddonName());
return true;
}
/**
* Returns the currently installed version of this addon.
*
* @return string the installed version or an empty string otherwise.
*/
public function getInstalledVersion()
{
if ($this->isCore()) {
return (EnterpriseUtils::pmVersion(System::getVersion()));
} else {
if ($this->isPlugin()) {
if (!$this->isInstalled()) {
return (null);
}
$oPluginRegistry = PluginRegistry::loadSingleton();
$details = $oPluginRegistry->getPluginDetails($this->getAddonName() . ".php");
$v = (!($details == null))? $details->getVersion() : null;
if ($v != "") {
return ($v);
}
if (file_exists(PATH_PLUGINS . $this->getAddonName() . PATH_SEP . "VERSION")) {
return (trim(file_get_contents(PATH_PLUGINS . $this->getAddonName() . PATH_SEP . "VERSION")));
}
} else {
if ($this->getAddonType() == "core") {
throw new Exception("Addon type \"" . $this->getAddonType() . "\" unsupported");
}
}
}
}
public function refresh()
{
/* Update our information from the db */
$rs = $this->getPeer()->doSelectRS($this->buildPkeyCriteria());
$rs->first();
$this->hydrate($rs);
}
/**
* Download this addon from the download url.
*
* @return bool true on success, false otherwise.
*/
public function download()
{
$this->setState("download");
///////
$aux = explode("?", $this->getAddonDownloadUrl());
$url = $aux[0];
$var = explode("&", $aux[1]);
///////
$boundary = "---------------------" . substr(G::encryptOld(rand(0, 32000)), 0, 10);
$data = null;
for ($i = 0; $i <= count($var) - 1; $i++) {
$aux = explode("=", $var[$i]);
$data = $data . "--$boundary\n";
$data = $data . "Content-Disposition: form-data; name=\"" . $aux[0] . "\"\n\n" . $aux[1] . "\n";
}
if (count($var) > 0) {
$data = $data . "--$boundary\n";
}
///////
$licenseManager = PmLicenseManager::getSingleton();
$activeLicense = $licenseManager->getActiveLicense();
$data = $data . "Content-Disposition: form-data; name=\"licenseFile\"; filename=\"" . $licenseManager->file . "\"\n";
$data = $data . "Content-Type: text/plain\n";
//$data = $data . "Content-Type: image/jpeg\n";
$data = $data . "Content-Transfer-Encoding: binary\n\n";
$data = $data . file_get_contents($activeLicense["LICENSE_PATH"]) . "\n";
$data = $data . "--$boundary\n";
///////
$option = array(
"http" => array(
"method" => "POST",
//"method" => "post",
"header" => "Content-Type: multipart/form-data; boundary=" . $boundary,
"content" => $data
)
);
// Proxy settings
$sysConf = System::getSystemConfiguration();
if ($sysConf['proxy_host'] != '') {
if (!is_array($option['http'])) {
$option['http'] = array();
}
$option['http']['request_fulluri'] = true;
$option['http']['proxy'] = 'tcp://' . $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '');
if ($sysConf['proxy_user'] != '') {
if (!isset($option['http']['header'])) {
$option['http']['header'] = '';
}
$option['http']['header'] .= 'Proxy-Authorization: Basic ' . base64_encode($sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
}
}
$context = stream_context_create($option);
///////
$handle = fopen($url, "rb", false, $context);
if ($handle === false) {
throw new Exception("Could not open download url.");
}
$this->setAddonDownloadFilename(null);
//Try to get the download size and filename (ok if it fails)
$meta = stream_get_meta_data($handle);
$totalSize = 0;
if ($meta["wrapper_type"] == "http") {
foreach ($meta["wrapper_data"] as $info) {
$info = explode(":", $info);
if (strcasecmp(trim($info[0]), "Content-Length") == 0) {
$totalSize = intval(trim($info[1]));
}
if (strcasecmp(trim($info[0]), "Content-Disposition") == 0) {
foreach (explode(";", $info[1]) as $params) {
$params = explode("=", $params);
if (count($params) <= 1) {
continue;
}
if (strcasecmp(trim($params[0]), "filename") == 0) {
$this->setAddonDownloadFilename(trim($params[1], "\" "));
}
}
}
}
}
//Save the filename
$this->save();
$units = array(" B", " KB", " MB", " GB", " TB");
//if ($totalSize) {
// $bytes = $totalSize;
// for ($i = 0; $bytes >= 1024 && $i < 4; $i++) $bytes /= 1024;
// printf("Download size: %.2f%s\n", round($bytes, 2), $units[$i]);
//}
$downloadFile = $this->getDownloadFilename();
$file = @fopen($downloadFile, "wb");
if ($file === false) {
throw new Exception("Could not open destination file.");
}
$start = microtime(true);
$rate = null;
$position = null;
$elapsed = null;
while (!feof($handle)) {
$this->refresh();
/* Check if download was cancelled from the ui */
if ($this->getAddonState() == "cancel" || $this->getAddonState() == "") {
$this->setState();
break;
}
/* Update the database information to show we are still alive */
$this->setState("download");
$data = fread($handle, BUFSIZE);
//TODO: We should use these values for something
$elapsed = microtime(true) - $start;
$position = ftell($handle);
$rate = $position / $elapsed;
if ($totalSize) {
$progress = 100 * ($position / $totalSize);
$this->setAddonDownloadProgress($progress);
$this->save();
}
/* Just to be safe, check all error conditions */
if ($data === "" or $data === false) {
break;
}
if (fwrite($file, $data) === false) {
break;
}
}
fclose($handle);
fclose($file);
if ($elapsed > 60) {
$time = sprintf("%.0f minutes and %.0f seconds", round($elapsed / 60), round($elapsed) % 60);
} else {
$time = sprintf("%.0f seconds", round($elapsed));
}
for ($i = 0; $position >= 1024 && $i < 4; $i++) {
$position /= 1024;
}
for ($j = 0; $rate >= 1024 && $j < 4; $j++) {
$rate /= 1024;
}
//printf("Downloaded %.2f%s in %s (rate: %.2f%s/s)\n", $position, $units[$i], $time, $rate, $units[$j]);
return ($this->checkDownload());
}
/**
* Install this addon from the downloaded file.
*/
public function install()
{
$this->setState("install");
$filename = $this->getDownloadFilename();
//if ($this->checkDownload() === false) {
// throw new Exception("Download file is invalid");
//}
if ($this->isPlugin()) {
if ($this->getAddonId() == "enterprise") {
$_SESSION["__ENTERPRISE_INSTALL__"] = 1;
}
$oPluginRegistry = PluginRegistry::loadSingleton();
$oPluginRegistry->installPluginArchive($filename, $this->getAddonName());
$this->setState();
} else {
throw new Exception("Addon type {$this->getAddonType()} not supported.");
}
}
public function uninstall()
{
if ($this->isPlugin()) {
if (!$this->isInstalled()) {
return false;
}
$oPluginRegistry = PluginRegistry::loadSingleton();
$oPluginRegistry->uninstallPlugin($this->getAddonName());
return true;
}
}
public function getInstallLog()
{
$logFile = $this->getDownloadDirectory() . "/download.log";
$contents = false;
if (file_exists($logFile)) {
$contents = @file_get_contents($logFile);
}
if ($contents === false) {
return null;
}
return $contents;
}
public function setState($state = "")
{
$this->setAddonState($state);
$this->setAddonStateChanged('now');
$this->save();
}
public function checkState()
{
if ($this->getAddonState() == 'error') {
$this->setState();
return false;
}
if ($this->getAddonState() == '' || $this->getAddonState() == 'install-finish') {
return true;
}
$elapsed = time() - strtotime($this->getAddonStateChanged());
$timeout = 3;
if ($this->isCore()) {
$timeout = 10;
}
if ($elapsed > $timeout * 60) {
$this->setState();
return false;
}
return true;
}
/**
* Exists in Addons Manager Table
*
* @param string $addonId
* @param string $storeId
* @return type
* @throws type
*/
public function exists($addonId, $storeId)
{
$oAddManager = AddonsManagerPeer::retrieveByPK($addonId, $storeId);
return (!is_null($oAddManager));
}
/**
* Update Addons Manager Table
*
* @param type $data
* @return type
* @throws type
*/
public function update($data)
{
$con = Propel::getConnection(AddonsManagerPeer::DATABASE_NAME);
try {
$con->begin();
$this->setNew(false);
$this->fromArray($data, BasePeer::TYPE_FIELDNAME);
if ($this->validate()) {
$result = $this->save();
$con->commit();
return $result;
} else {
$con->rollback();
throw (new Exception("Failed Validation in class " . get_class($this) . "."));
}
} catch (Exception $e) {
$con->rollback();
throw ($e);
}
}
}

View File

@@ -1,24 +0,0 @@
<?php
// include base peer class
require_once 'classes/model/om/BaseAddonsManagerPeer.php';
// include object class
include_once 'classes/model/AddonsManager.php';
/**
* Skeleton subclass for performing query and update operations on the 'UPGRADE_MANAGER' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package classes.model
*/
class AddonsManagerPeer extends BaseAddonsManagerPeer
{
}

View File

@@ -1,637 +0,0 @@
<?php
use Illuminate\Support\Facades\Cache;
use ProcessMaker\Core\System;
use ProcessMaker\Plugins\PluginRegistry;
require_once 'classes/model/om/BaseAddonsStore.php';
define("STORE_VERSION", 1);
class AddonsStore extends BaseAddonsStore
{
/**
* Add a store to the database
*
* @param string $storeId 32-character long store id
* @param string $storeLocation URL to obtain the store info
* @param string $storeType type of store (only "license" supported now)
* @param string $storeVersion version of the data store
*/
public static function addStore($storeId, $storeLocation, $storeType = "license", $storeVersion = STORE_VERSION)
{
$store = new AddonsStore();
$store->setStoreId($storeId);
$store->setStoreLocation($storeLocation);
$store->setStoreVersion($storeVersion);
$store->setStoreType($storeType);
return AddonsStorePeer::doInsert($store);
}
/**
* Check if the current license has a store and removes unwanted stores.
*
* @return bool true if a store was added, false otherwise.
*/
public static function checkLicenseStore()
{
//getting the licenseManager....
$licenseManager = PmLicenseManager::getSingleton();
if (isset($licenseManager->id)) {
//Remove any license store that is not the active license
$criteria = new Criteria(AddonsStorePeer::DATABASE_NAME);
$criteria->addSelectColumn("*");
$criteria->add(AddonsStorePeer::STORE_TYPE, "license", Criteria::EQUAL);
$criteria->add(AddonsStorePeer::STORE_ID, $licenseManager->id, Criteria::NOT_EQUAL);
foreach (AddonsStorePeer::doSelect($criteria) as $store) {
$store->clear();
}
AddonsStorePeer::doDelete($criteria);
//If the active license doesn't have a store, add one for it
if (AddonsStorePeer::retrieveByPK($licenseManager->id) === null) {
preg_match("/^license_(.*).dat$/", $licenseManager->file, $matches);
$realId = urlencode($matches[1]);
$workspace = (isset($licenseManager->workspace)) ? $licenseManager->workspace : 'pmLicenseSrv';
$addonLocation = "http://{$licenseManager->server}/sys".$workspace."/en/green/services/addonsStore?action=getInfo&licId=$realId";
self::addStore($licenseManager->id, $addonLocation);
return true;
}
}
return false;
}
public static function addonList($type = 'plugin')
{
$result = array();
AddonsStore::checkLicenseStore();
$licenseManager = PmLicenseManager::getSingleton(); //Getting the licenseManager
$result["store_errors"] = array();
list($stores, $errors) = AddonsStore::updateAll(false, $type);
foreach ($errors as $store_id => $store_error) {
$result["store_errors"][] = array("id" => $store_id, "msg" => $store_error);
}
$result["addons"] = array();
$result["errors"] = array();
$criteria = new Criteria();
$criteria->addAscendingOrderByColumn(AddonsManagerPeer::ADDON_TYPE);
$criteria->addAscendingOrderByColumn(AddonsManagerPeer::ADDON_ID);
$criteria->add(AddonsManagerPeer::ADDON_TYPE, $type, Criteria::EQUAL);
$addons = AddonsManagerPeer::doSelect($criteria);
foreach ($addons as $addon) {
if ($addon->getAddonState() != '' && $addon->isInstalled()) {
$addon->setState();
$addon->refresh();
}
$status = $addon->getAddonStatus();
$version = $addon->getAddonVersion();
$enabled = null;
if (!$addon->checkState()) {
$result["errors"][] = array("addonId" => $addon->getAddonId(), "storeId" => $addon->getStoreId());
}
$sw = 1;
if ($type == 'plugin') {
$addonInLicense = false;
if (!empty($addon->getAddonId()) && !empty($licenseManager->features)) {
$addonInLicense = in_array($addon->getAddonId(), $licenseManager->features);
}
if ($sw == 1 && $addon->getAddonId() != "enterprise" && !$addonInLicense) {
$sw = 0;
}
if ($sw == 1 && $addon->isInstalled()) {
if ($addon->isEnabled()) {
$status = "installed";
} else {
$status = "disabled";
}
$version = $addon->getInstalledVersion();
if (version_compare($version . "", $addon->getAddonVersion() . "", "<")) {
$status = "upgrade";
}
$enabled = (bool)$addon->isEnabled();
$sw = 0;
}
} else {
$status = "available";
$enabled = false;
$addonInLicense = in_array($addon->getAddonId(), $licenseManager->licensedfeatures);
if (in_array($addon->getAddonName(), $licenseManager->licensedfeatures) == 1) {
$status = "installed";
$enabled = true;
}
}
if ($sw == 1 && $addonInLicense) {
$status = "ready";
$sw = 0;
}
$state = $addon->getAddonState();
$log = null;
if ($state != null) {
$status = $state;
$log = $addon->getInstallLog();
}
if ($addon->getAddonId() == "enterprise" && $status== 'ready') {
$status = 'installed';
}
if ($status == 'minus-circle') {
$status = "available";
}
$result["addons"][$addon->getAddonId()] = array(
"id" => $addon->getAddonId(),
"store" => $addon->getStoreId(),
"name" => $addon->getAddonName(),
"nick" => $addon->getAddonNick(),
"version" => $version,
"enabled" => $enabled,
"latest_version" => $addon->getAddonVersion(),
"type" => $addon->getAddonType(),
"release_type" => $addon->getAddonReleaseType(),
"url" => $addon->getAddonDownloadUrl(),
"publisher" => $addon->getAddonPublisher(),
"description" => $addon->getAddonDescription(),
"status" => $status,
"log" => $log,
"progress" => round($addon->getAddonDownloadProgress())
);
}
return $result;
}
public static function addonFeatureList()
{
$result = array();
AddonsStore::checkLicenseStore();
$licenseManager = PmLicenseManager::getSingleton(); //Getting the licenseManager
$result["store_errors"] = array();
list($stores, $errors) = AddonsStore::updateAll(false);
foreach ($errors as $store_id => $store_error) {
$result["store_errors"][] = array("id" => $store_id, "msg" => $store_error);
}
$result["addons"] = array();
$result["errors"] = array();
$criteria = new Criteria();
$criteria->addAscendingOrderByColumn(AddonsManagerPeer::ADDON_TYPE);
$criteria->addAscendingOrderByColumn(AddonsManagerPeer::ADDON_ID);
$addons = AddonsManagerPeer::doSelect($criteria);
foreach ($addons as $addon) {
$status = $addon->getAddonStatus();
$version = $addon->getAddonVersion();
$enabled = null;
if (!$addon->checkState()) {
$result["errors"][] = array("addonId" => $addon->getAddonId(), "storeId" => $addon->getStoreId());
}
$sw = 1;
$addonInLicense = false;
if (!empty($addon->getAddonId()) && !empty($licenseManager->features)) {
$addonInLicense = in_array($addon->getAddonId(), $licenseManager->features);
}
if ($sw == 1 && $addon->getAddonId() != "enterprise" && !$addonInLicense) {
$sw = 0;
}
if ($sw == 1 && $addon->isInstalled()) {
if ($addon->isEnabled()) {
$status = "installed";
} else {
$status = "disabled";
}
$version = $addon->getInstalledVersion();
if (version_compare($version . "", $addon->getAddonVersion() . "", "<")) {
$status = "upgrade";
}
$enabled = $addon->isEnabled();
$sw = 0;
}
if ($sw == 1 && $addonInLicense) {
$status = "ready";
$sw = 0;
}
$state = $addon->getAddonState();
$log = null;
if ($state != null) {
$status = $state;
$log = $addon->getInstallLog();
}
if ($addon->getAddonId() == "enterprise" && $status== 'ready') {
$status = 'installed';
}
if ($status == 'minus-circle') {
$status = "available";
}
$result["addons"][$addon->getAddonId()] = array(
"id" => $addon->getAddonId(),
"store" => $addon->getStoreId(),
"name" => $addon->getAddonName(),
"nick" => $addon->getAddonNick(),
"version" => $version,
"enabled" => $enabled,
"latest_version" => $addon->getAddonVersion(),
"type" => $addon->getAddonType(),
"release_type" => $addon->getAddonReleaseType(),
"url" => $addon->getAddonDownloadUrl(),
"publisher" => $addon->getAddonPublisher(),
"description" => $addon->getAddonDescription(),
"status" => $status,
"log" => $log,
"progress" => round($addon->getAddonDownloadProgress())
);
}
return $result;
}
/**
* Returns all stores as AddonsStore objects.
*
* @return array of AddonsStore objects
*/
public static function listStores()
{
$criteria = new Criteria(AddonsStorePeer::DATABASE_NAME);
return AddonsStorePeer::doSelect($criteria);
}
/**
* Updates all stores
*
* @return array containing a 'stores' array and a 'errors' array
*/
public static function updateAll($force = false, $type = 'plugin')
{
$stores = array();
$errors = array();
foreach (self::listStores() as $store) {
try {
$stores[$store->getStoreId()] = $store->update($force, $type);
} catch (Exception $e) {
$errors[$store->getStoreId()] = $e->getMessage();
}
}
return array($stores, $errors);
}
/**
* Clear this store addons
*
* @return int number of addons removed
*/
public function clear($type = 'plugin')
{
/* Remove old items from this store */
$criteria = new Criteria(AddonsManagerPeer::DATABASE_NAME);
$criteria->add(AddonsManagerPeer::STORE_ID, $this->getStoreId(), Criteria::EQUAL);
$criteria->add(AddonsManagerPeer::ADDON_TYPE, $type, Criteria::EQUAL);
return AddonsManagerPeer::doDelete($criteria);
}
/**
* Update this store information from the store location.
*
* @return bool true if updated, false otherwise
*/
public function update($force = false, $type = 'plugin')
{
//If we have any addon that is installing or updating, don't update store
$criteria = new Criteria(AddonsManagerPeer::DATABASE_NAME);
$criteria->add(AddonsManagerPeer::ADDON_STATE, '', Criteria::NOT_EQUAL);
$criteria->add(AddonsManagerPeer::ADDON_TYPE, $type);
if (AddonsManagerPeer::doCount($criteria) > 0) {
return false;
}
$this->clear($type);
//Fill with local information
//List all plugins installed
$oPluginRegistry = PluginRegistry::loadSingleton();
$aPluginsPP = array();
$eeData = Cache::get(config('system.workspace') . 'enterprise.ee', function () {
if (file_exists(PATH_DATA_SITE . 'ee')) {
return trim(file_get_contents(PATH_DATA_SITE . 'ee'));
}
return null;
});
if ($eeData) {
$aPluginsPP = unserialize($eeData);
}
$pmLicenseManagerO = PmLicenseManager::getSingleton();
$localPlugins = array();
if ($type == 'plugin') {
foreach ($aPluginsPP as $aPlugin) {
$sClassName = substr($aPlugin['sFilename'], 0, strpos($aPlugin['sFilename'], '-'));
if (file_exists(PATH_PLUGINS . $sClassName . '.php')) {
require_once PATH_PLUGINS . $sClassName . '.php';
$oDetails = $oPluginRegistry->getPluginDetails($sClassName . '.php');
if ($oDetails) {
$sStatus = $oDetails->isEnabled() ? G::LoadTranslation('ID_ENABLED') : G::LoadTranslation('ID_DISABLED');
if ($oDetails->getWorkspaces()) {
if (!in_array(config("system.workspace"), $oDetails->getWorkspaces())) {
continue;
}
}
if ($sClassName == "pmLicenseManager" || $sClassName == "pmTrial") {
continue;
}
$sEdit = (($oDetails->getSetupPage() != '') && ($oDetails->isEnabled())? G::LoadTranslation('ID_SETUP') : ' ');
$aPlugin = array();
$aPluginId = $sClassName;
$aPluginTitle = $oDetails->getFriendlyName();
$aPluginDescription = $oDetails->getDescription();
$aPluginVersion = $oDetails->getVersion();
if (@in_array($sClassName, $pmLicenseManagerO->features)) {
$aPluginStatus = $sStatus;
$aPluginLinkStatus = 'pluginsChange?id=' . $sClassName . '.php&status=' . $oDetails->isEnabled();
$aPluginEdit = $sEdit;
$aPluginLinkEdit = 'pluginsSetup?id=' . $sClassName . '.php';
$aPluginStatusA = $sStatus == "Enabled" ? "installed" : 'disabled';
$enabledStatus = true;
} else {
$aPluginStatus = "";
$aPluginLinkStatus = '';
$aPluginEdit = '';
$aPluginLinkEdit = '';
$aPluginStatusA = 'minus-circle';
$enabledStatus = false;
}
$addon = new AddonsManager();
//G::pr($addon);
$addon->setAddonId($aPluginId);
$addon->setStoreId($this->getStoreId());
//Don't trust external data
$addon->setAddonName($aPluginId);
$addon->setAddonDescription($aPluginDescription);
$addon->setAddonNick($aPluginTitle);
$addon->setAddonVersion("");
$addon->setAddonStatus($aPluginStatusA);
$addon->setAddonType("plugin");
$addon->setAddonPublisher("Colosa");
$addon->setAddonDownloadUrl("");
$addon->setAddonDownloadMd5("");
$addon->setAddonReleaseDate(null);
$addon->setAddonReleaseType('localRegistry');
$addon->setAddonReleaseNotes("");
$addon->setAddonState("");
$addon->save();
$localPlugins[$aPluginId] = $addon;
}
}
}
} else {
$list = unserialize($pmLicenseManagerO->licensedfeaturesList);
if (is_array($list)) {
foreach ($list['addons'] as $key => $feature) {
$addon = new AddonsManager();
if ($addon->exists($feature['name'], $feature['guid'])) {
$arrayData['ADDON_ID'] = $feature['name'];
$arrayData['STORE_ID'] = $feature['guid'];
$arrayData['ADDON_NAME'] = $feature['name'];
$arrayData['ADDON_NICK'] = $feature['nick'];
$arrayData['ADDON_DESCRIPTION'] = $feature['description'];
$arrayData['ADDON_STATE'] = '';
$arrayData['ADDON_STATUS'] = $feature['status'];
$arrayData['ADDON_VERSION'] = '';
$arrayData['ADDON_TYPE'] = 'features';
$arrayData['ADDON_PUBLISHER'] = 'Colosa';
$arrayData['ADDON_RELEASE_DATE'] = null;
$arrayData['ADDON_RELEASE_TYPE'] = 'localRegistry';
$arrayData['ADDON_RELEASE_NOTES'] = '';
$arrayData['ADDON_DOWNLOAD_URL'] = '';
$arrayData['ADDON_DOWNLOAD_MD5'] = '';
$addon->update($arrayData);
} else {
$addon->setAddonId($feature['name']);
$addon->setStoreId($feature['guid']);
$addon->setAddonName($feature['name']);
$addon->setAddonDescription($feature['description']);
$addon->setAddonNick($feature['nick']);
$addon->setAddonVersion("");
$addon->setAddonStatus($feature['status']);
$addon->setAddonType("features");
$addon->setAddonPublisher("Colosa");
$addon->setAddonDownloadUrl("");
$addon->setAddonDownloadMd5("");
$addon->setAddonReleaseDate(null);
$addon->setAddonReleaseType('localRegistry');
$addon->setAddonReleaseNotes("");
$addon->setAddonState("");
$addon->save();
}
}
}
}
$this->setStoreLastUpdated(time());
$this->save();
$url = $this->getStoreLocation();
//Validate url
$licenseInfo = $pmLicenseManagerO->getActiveLicense();
$licenseId = str_replace('.dat', '', str_replace('license_', '', basename($licenseInfo['LICENSE_PATH'])));
$url = explode('&', $url);
$url[count($url) - 1] = 'licId=' . urlencode($licenseId);
$url = implode('&', $url);
if (EnterpriseUtils::getInternetConnection() == 1 && EnterpriseUtils::checkConnectivity($url) == true) {
$option = array(
"http" => array(
"method" => "POST",
"header" => "Content-type: application/x-www-form-urlencoded\r\n",
"content" => http_build_query(
array(
"pmVersion" => System::getVersion(),
"version" => STORE_VERSION
)
)
)
);
// Proxy settings
$sysConf = System::getSystemConfiguration();
if (isset($sysConf['proxy_host'])) {
if ($sysConf['proxy_host'] != '') {
if (!is_array($option['http'])) {
$option['http'] = array();
}
$option['http']['request_fulluri'] = true;
$option['http']['proxy'] = 'tcp://' . $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '');
if ($sysConf['proxy_user'] != '') {
if (!isset($option['http']['header'])) {
$option['http']['header'] = '';
}
$option['http']['header'] .= 'Proxy-Authorization: Basic ' . base64_encode($sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
}
}
}
$context = stream_context_create($option);
//This may block for a while, always use AJAX to call this method
$url = $url . '&type=' . strtoupper($type);
$data = file_get_contents($url, false, $context);
if ($data === false) {
throw new Exception("Could not contact store");
}
$serverData = G::json_decode($data);
//Don't trust external data
if (empty($serverData)) {
throw (new Exception("Store data invalid ('$data')"));
}
if (isset($serverData->error)) {
throw (new Exception("Store sent us an error: {$serverData->error}"));
}
if (!isset($serverData->version)) {
throw (new Exception("Store version not found"));
}
if ($serverData->version != STORE_VERSION) {
throw (new Exception("Store version '{$serverData->version}' unsupported"));
}
if (!isset($serverData->addons)) {
throw (new Exception("Addons not found on store data"));
}
$this->clear($type);
try {
//Add each item to this stores addons
$addons = !is_array($serverData->addons) ? get_object_vars($serverData->addons) : $serverData->addons;
if (!empty($addons)) {
foreach (get_object_vars($serverData->addons) as $addonId => $addonInfo) {
$addon = new AddonsManager();
$addon->setAddonId($addonId);
$addon->setStoreId($this->getStoreId());
//Don't trust external data
$addon->setAddonName(isset($addonInfo->name)? $addonInfo->name : $addonId);
$addon->setAddonDescription(isset($addonInfo->description)? $addonInfo->description : "");
$addon->setAddonNick(isset($addonInfo->nick)? $addonInfo->nick : "");
$addon->setAddonVersion(isset($addonInfo->version)? $addonInfo->version : "");
$addon->setAddonStatus(isset($addonInfo->status)? $addonInfo->status : "");
$addon->setAddonType(isset($addonInfo->type)? $addonInfo->type : "");
$addon->setAddonPublisher(isset($addonInfo->publisher)? $addonInfo->publisher : "");
$workspace = (isset($pmLicenseManagerO->workspace)) ? $pmLicenseManagerO->workspace : 'pmLicenseSrv';
$addon->setAddonDownloadUrl(isset($addonInfo->download_url)? $addonInfo->download_url : "http://" . $pmLicenseManagerO->server . "/sys".$workspace."/en/green/services/rest?action=getPlugin&OBJ_UID=" . $addonInfo->guid);
$addon->setAddonDownloadMd5(isset($addonInfo->download_md5)? $addonInfo->download_md5 : "");
$addon->setAddonReleaseDate(isset($addonInfo->release_date)? $addonInfo->release_date : "");
$addon->setAddonReleaseType(isset($addonInfo->release_type)? $addonInfo->release_type : '');
$addon->setAddonReleaseNotes(isset($addonInfo->release_notes)? $addonInfo->release_notes : "");
$addon->setAddonState("");
$addon->save();
if (isset($localPlugins[$addonId])) {
unset($localPlugins[$addonId]);
}
}
foreach ($localPlugins as $keyPlugin => $addonA) {
//G::pr($addonA );
//$addonA->save();
$addon = new AddonsManager();
//G::pr($addon);
$addon->setAddonId($addonA->getAddonId());
$addon->setStoreId($addonA->getStoreId());
//Don't trust external data
$addon->setAddonName($addonA->getAddonName());
$addon->setAddonDescription($addonA->getAddonDescription());
$addon->setAddonNick($addonA->getAddonNick());
$addon->setAddonVersion("");
$addon->setAddonStatus($addonA->getAddonStatus());
$addon->setAddonType($addonA->getAddonType());
$addon->setAddonPublisher($addonA->getAddonPublisher());
$addon->setAddonDownloadUrl($addonA->getAddonDownloadUrl());
$addon->setAddonDownloadMd5($addonA->getAddonDownloadMd5());
$addon->setAddonReleaseDate(null);
$addon->setAddonReleaseType('localRegistry');
$addon->setAddonReleaseNotes("");
$addon->setAddonState("");
$addon->save();
}
}
$this->setStoreLastUpdated(time());
$this->save();
} catch (Exception $e) {
//If we had issues, don't keep only a part of the items
$this->clear($type);
throw $e;
}
}
return true;
}
}

View File

@@ -1,24 +0,0 @@
<?php
// include base peer class
require_once 'classes/model/om/BaseAddonsStorePeer.php';
// include object class
include_once 'classes/model/AddonsStore.php';
/**
* Skeleton subclass for performing query and update operations on the 'ADDONS_STORE' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package classes.model
*/
class AddonsStorePeer extends BaseAddonsStorePeer
{
}

View File

@@ -1,20 +0,0 @@
<?php
require_once 'classes/model/om/BaseLicenseManager.php';
/**
* Skeleton subclass for representing a row from the 'LICENSE_MANAGER' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package classes.model
*/
class LicenseManager extends BaseLicenseManager
{
}

View File

@@ -1,24 +0,0 @@
<?php
// include base peer class
require_once 'classes/model/om/BaseLicenseManagerPeer.php';
// include object class
include_once 'classes/model/LicenseManager.php';
/**
* Skeleton subclass for performing query and update operations on the 'LICENSE_MANAGER' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package classes.model
*/
class LicenseManagerPeer extends BaseLicenseManagerPeer
{
}

View File

@@ -1,70 +0,0 @@
<?php
require_once 'propel/map/MapBuilder.php';
include_once 'creole/CreoleTypes.php';
/**
* This class adds structure of 'ADDON_STORE' table to 'propel' DatabaseMap object.
*
*
*
* These statically-built map classes are used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package workflow.classes.model.map
*/
class AddonStoreMapBuilder
{
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'classes.model.map.AddonStoreMapBuilder';
/**
* The database map.
*/
private $dbMap;
/**
* Tells us if this DatabaseMapBuilder is built so that we
* don't have to re-build it every time.
*
* @return boolean true if this DatabaseMapBuilder is built, false otherwise.
*/
public function isBuilt()
{
return ($this->dbMap !== null);
}
/**
* Gets the databasemap this map builder built.
*
* @return the databasemap
*/
public function getDatabaseMap()
{
return $this->dbMap;
}
/**
* The doBuild() method builds the DatabaseMap
*
* @return void
* @throws PropelException
*/
public function doBuild()
{
$this->dbMap = Propel::getDatabaseMap('propel');
$tMap = $this->dbMap->addTable('ADDON_STORE');
$tMap->setPhpName('AddonStore');
$tMap->setUseIdGenerator(false);
$tMap->addPrimaryKey('STORE_ID', 'StoreId', 'string', CreoleTypes::VARCHAR, true, 32);
$tMap->addColumn('STORE_VERSION', 'StoreVersion', 'int', CreoleTypes::INTEGER, false, null);
$tMap->addColumn('STORE_LOCATION', 'StoreLocation', 'string', CreoleTypes::VARCHAR, true, 2048);
$tMap->addColumn('LAST_UPDATED', 'LastUpdated', 'int', CreoleTypes::TIMESTAMP, false, null);
}
}

View File

@@ -1,106 +0,0 @@
<?php
require_once 'propel/map/MapBuilder.php';
include_once 'creole/CreoleTypes.php';
/**
* This class adds structure of 'ADDONS_MANAGER' table to 'workflow' DatabaseMap object.
*
*
*
* These statically-built map classes are used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package workflow.classes.model.map
*/
class AddonsManagerMapBuilder
{
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'classes.model.map.AddonsManagerMapBuilder';
/**
* The database map.
*/
private $dbMap;
/**
* Tells us if this DatabaseMapBuilder is built so that we
* don't have to re-build it every time.
*
* @return boolean true if this DatabaseMapBuilder is built, false otherwise.
*/
public function isBuilt()
{
return ($this->dbMap !== null);
}
/**
* Gets the databasemap this map builder built.
*
* @return the databasemap
*/
public function getDatabaseMap()
{
return $this->dbMap;
}
/**
* The doBuild() method builds the DatabaseMap
*
* @return void
* @throws PropelException
*/
public function doBuild()
{
$this->dbMap = Propel::getDatabaseMap('workflow');
$tMap = $this->dbMap->addTable('ADDONS_MANAGER');
$tMap->setPhpName('AddonsManager');
$tMap->setUseIdGenerator(false);
$tMap->addPrimaryKey('ADDON_ID', 'AddonId', 'string', CreoleTypes::VARCHAR, true, 255);
$tMap->addPrimaryKey('STORE_ID', 'StoreId', 'string', CreoleTypes::VARCHAR, true, 32);
$tMap->addColumn('ADDON_NAME', 'AddonName', 'string', CreoleTypes::VARCHAR, true, 255);
$tMap->addColumn('ADDON_NICK', 'AddonNick', 'string', CreoleTypes::VARCHAR, true, 255);
$tMap->addColumn('ADDON_DOWNLOAD_FILENAME', 'AddonDownloadFilename', 'string', CreoleTypes::VARCHAR, false, 1024);
$tMap->addColumn('ADDON_DESCRIPTION', 'AddonDescription', 'string', CreoleTypes::VARCHAR, false, 2048);
$tMap->addColumn('ADDON_STATE', 'AddonState', 'string', CreoleTypes::VARCHAR, true, 255);
$tMap->addColumn('ADDON_STATE_CHANGED', 'AddonStateChanged', 'int', CreoleTypes::TIMESTAMP, false, null);
$tMap->addColumn('ADDON_STATUS', 'AddonStatus', 'string', CreoleTypes::VARCHAR, true, 255);
$tMap->addColumn('ADDON_VERSION', 'AddonVersion', 'string', CreoleTypes::VARCHAR, true, 255);
$tMap->addColumn('ADDON_TYPE', 'AddonType', 'string', CreoleTypes::VARCHAR, true, 255);
$tMap->addColumn('ADDON_PUBLISHER', 'AddonPublisher', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('ADDON_RELEASE_DATE', 'AddonReleaseDate', 'int', CreoleTypes::TIMESTAMP, false, null);
$tMap->addColumn('ADDON_RELEASE_TYPE', 'AddonReleaseType', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('ADDON_RELEASE_NOTES', 'AddonReleaseNotes', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('ADDON_DOWNLOAD_URL', 'AddonDownloadUrl', 'string', CreoleTypes::VARCHAR, false, 2048);
$tMap->addColumn('ADDON_DOWNLOAD_PROGRESS', 'AddonDownloadProgress', 'double', CreoleTypes::FLOAT, false, null);
$tMap->addColumn('ADDON_DOWNLOAD_MD5', 'AddonDownloadMd5', 'string', CreoleTypes::VARCHAR, false, 32);
} // doBuild()
} // AddonsManagerMapBuilder

View File

@@ -1,80 +0,0 @@
<?php
require_once 'propel/map/MapBuilder.php';
include_once 'creole/CreoleTypes.php';
/**
* This class adds structure of 'ADDONS_STORE' table to 'workflow' DatabaseMap object.
*
*
*
* These statically-built map classes are used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package workflow.classes.model.map
*/
class AddonsStoreMapBuilder
{
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'classes.model.map.AddonsStoreMapBuilder';
/**
* The database map.
*/
private $dbMap;
/**
* Tells us if this DatabaseMapBuilder is built so that we
* don't have to re-build it every time.
*
* @return boolean true if this DatabaseMapBuilder is built, false otherwise.
*/
public function isBuilt()
{
return ($this->dbMap !== null);
}
/**
* Gets the databasemap this map builder built.
*
* @return the databasemap
*/
public function getDatabaseMap()
{
return $this->dbMap;
}
/**
* The doBuild() method builds the DatabaseMap
*
* @return void
* @throws PropelException
*/
public function doBuild()
{
$this->dbMap = Propel::getDatabaseMap('workflow');
$tMap = $this->dbMap->addTable('ADDONS_STORE');
$tMap->setPhpName('AddonsStore');
$tMap->setUseIdGenerator(false);
$tMap->addPrimaryKey('STORE_ID', 'StoreId', 'string', CreoleTypes::VARCHAR, true, 32);
$tMap->addColumn('STORE_VERSION', 'StoreVersion', 'int', CreoleTypes::INTEGER, false, null);
$tMap->addColumn('STORE_LOCATION', 'StoreLocation', 'string', CreoleTypes::VARCHAR, true, 2048);
$tMap->addColumn('STORE_TYPE', 'StoreType', 'string', CreoleTypes::VARCHAR, true, 255);
$tMap->addColumn('STORE_LAST_UPDATED', 'StoreLastUpdated', 'int', CreoleTypes::TIMESTAMP, false, null);
} // doBuild()
} // AddonsStoreMapBuilder

View File

@@ -1,90 +0,0 @@
<?php
require_once 'propel/map/MapBuilder.php';
include_once 'creole/CreoleTypes.php';
/**
* This class adds structure of 'LICENSE_MANAGER' table to 'workflow' DatabaseMap object.
*
*
*
* These statically-built map classes are used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package workflow.classes.model.map
*/
class LicenseManagerMapBuilder
{
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'classes.model.map.LicenseManagerMapBuilder';
/**
* The database map.
*/
private $dbMap;
/**
* Tells us if this DatabaseMapBuilder is built so that we
* don't have to re-build it every time.
*
* @return boolean true if this DatabaseMapBuilder is built, false otherwise.
*/
public function isBuilt()
{
return ($this->dbMap !== null);
}
/**
* Gets the databasemap this map builder built.
*
* @return the databasemap
*/
public function getDatabaseMap()
{
return $this->dbMap;
}
/**
* The doBuild() method builds the DatabaseMap
*
* @return void
* @throws PropelException
*/
public function doBuild()
{
$this->dbMap = Propel::getDatabaseMap('workflow');
$tMap = $this->dbMap->addTable('LICENSE_MANAGER');
$tMap->setPhpName('LicenseManager');
$tMap->setUseIdGenerator(false);
$tMap->addPrimaryKey('LICENSE_UID', 'LicenseUid', 'string', CreoleTypes::VARCHAR, true, 32);
$tMap->addColumn('LICENSE_USER', 'LicenseUser', 'string', CreoleTypes::VARCHAR, true, 150);
$tMap->addColumn('LICENSE_START', 'LicenseStart', 'int', CreoleTypes::INTEGER, true, null);
$tMap->addColumn('LICENSE_END', 'LicenseEnd', 'int', CreoleTypes::INTEGER, true, null);
$tMap->addColumn('LICENSE_SPAN', 'LicenseSpan', 'int', CreoleTypes::INTEGER, true, null);
$tMap->addColumn('LICENSE_STATUS', 'LicenseStatus', 'string', CreoleTypes::VARCHAR, true, 100);
$tMap->addColumn('LICENSE_DATA', 'LicenseData', 'string', CreoleTypes::LONGVARCHAR, true, null);
$tMap->addColumn('LICENSE_PATH', 'LicensePath', 'string', CreoleTypes::VARCHAR, true, 255);
$tMap->addColumn('LICENSE_WORKSPACE', 'LicenseWorkspace', 'string', CreoleTypes::VARCHAR, true, 32);
$tMap->addColumn('LICENSE_TYPE', 'LicenseType', 'string', CreoleTypes::VARCHAR, true, 32);
} // doBuild()
} // LicenseManagerMapBuilder

File diff suppressed because it is too large Load Diff

View File

@@ -1,642 +0,0 @@
<?php
require_once 'propel/util/BasePeer.php';
// The object class -- needed for instanceof checks in this class.
// actual class may be a subclass -- as returned by AddonsManagerPeer::getOMClass()
include_once 'classes/model/AddonsManager.php';
/**
* Base static class for performing query and update operations on the 'ADDONS_MANAGER' table.
*
*
*
* @package workflow.classes.model.om
*/
abstract class BaseAddonsManagerPeer
{
/** the default database name for this class */
const DATABASE_NAME = 'workflow';
/** the table name for this class */
const TABLE_NAME = 'ADDONS_MANAGER';
/** A class that can be returned by this peer. */
const CLASS_DEFAULT = 'classes.model.AddonsManager';
/** The total number of columns. */
const NUM_COLUMNS = 18;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the ADDON_ID field */
const ADDON_ID = 'ADDONS_MANAGER.ADDON_ID';
/** the column name for the STORE_ID field */
const STORE_ID = 'ADDONS_MANAGER.STORE_ID';
/** the column name for the ADDON_NAME field */
const ADDON_NAME = 'ADDONS_MANAGER.ADDON_NAME';
/** the column name for the ADDON_NICK field */
const ADDON_NICK = 'ADDONS_MANAGER.ADDON_NICK';
/** the column name for the ADDON_DOWNLOAD_FILENAME field */
const ADDON_DOWNLOAD_FILENAME = 'ADDONS_MANAGER.ADDON_DOWNLOAD_FILENAME';
/** the column name for the ADDON_DESCRIPTION field */
const ADDON_DESCRIPTION = 'ADDONS_MANAGER.ADDON_DESCRIPTION';
/** the column name for the ADDON_STATE field */
const ADDON_STATE = 'ADDONS_MANAGER.ADDON_STATE';
/** the column name for the ADDON_STATE_CHANGED field */
const ADDON_STATE_CHANGED = 'ADDONS_MANAGER.ADDON_STATE_CHANGED';
/** the column name for the ADDON_STATUS field */
const ADDON_STATUS = 'ADDONS_MANAGER.ADDON_STATUS';
/** the column name for the ADDON_VERSION field */
const ADDON_VERSION = 'ADDONS_MANAGER.ADDON_VERSION';
/** the column name for the ADDON_TYPE field */
const ADDON_TYPE = 'ADDONS_MANAGER.ADDON_TYPE';
/** the column name for the ADDON_PUBLISHER field */
const ADDON_PUBLISHER = 'ADDONS_MANAGER.ADDON_PUBLISHER';
/** the column name for the ADDON_RELEASE_DATE field */
const ADDON_RELEASE_DATE = 'ADDONS_MANAGER.ADDON_RELEASE_DATE';
/** the column name for the ADDON_RELEASE_TYPE field */
const ADDON_RELEASE_TYPE = 'ADDONS_MANAGER.ADDON_RELEASE_TYPE';
/** the column name for the ADDON_RELEASE_NOTES field */
const ADDON_RELEASE_NOTES = 'ADDONS_MANAGER.ADDON_RELEASE_NOTES';
/** the column name for the ADDON_DOWNLOAD_URL field */
const ADDON_DOWNLOAD_URL = 'ADDONS_MANAGER.ADDON_DOWNLOAD_URL';
/** the column name for the ADDON_DOWNLOAD_PROGRESS field */
const ADDON_DOWNLOAD_PROGRESS = 'ADDONS_MANAGER.ADDON_DOWNLOAD_PROGRESS';
/** the column name for the ADDON_DOWNLOAD_MD5 field */
const ADDON_DOWNLOAD_MD5 = 'ADDONS_MANAGER.ADDON_DOWNLOAD_MD5';
/** The PHP to DB Name Mapping */
private static $phpNameMap = null;
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('AddonId', 'StoreId', 'AddonName', 'AddonNick', 'AddonDownloadFilename', 'AddonDescription', 'AddonState', 'AddonStateChanged', 'AddonStatus', 'AddonVersion', 'AddonType', 'AddonPublisher', 'AddonReleaseDate', 'AddonReleaseType', 'AddonReleaseNotes', 'AddonDownloadUrl', 'AddonDownloadProgress', 'AddonDownloadMd5', ),
BasePeer::TYPE_COLNAME => array (AddonsManagerPeer::ADDON_ID, AddonsManagerPeer::STORE_ID, AddonsManagerPeer::ADDON_NAME, AddonsManagerPeer::ADDON_NICK, AddonsManagerPeer::ADDON_DOWNLOAD_FILENAME, AddonsManagerPeer::ADDON_DESCRIPTION, AddonsManagerPeer::ADDON_STATE, AddonsManagerPeer::ADDON_STATE_CHANGED, AddonsManagerPeer::ADDON_STATUS, AddonsManagerPeer::ADDON_VERSION, AddonsManagerPeer::ADDON_TYPE, AddonsManagerPeer::ADDON_PUBLISHER, AddonsManagerPeer::ADDON_RELEASE_DATE, AddonsManagerPeer::ADDON_RELEASE_TYPE, AddonsManagerPeer::ADDON_RELEASE_NOTES, AddonsManagerPeer::ADDON_DOWNLOAD_URL, AddonsManagerPeer::ADDON_DOWNLOAD_PROGRESS, AddonsManagerPeer::ADDON_DOWNLOAD_MD5, ),
BasePeer::TYPE_FIELDNAME => array ('ADDON_ID', 'STORE_ID', 'ADDON_NAME', 'ADDON_NICK', 'ADDON_DOWNLOAD_FILENAME', 'ADDON_DESCRIPTION', 'ADDON_STATE', 'ADDON_STATE_CHANGED', 'ADDON_STATUS', 'ADDON_VERSION', 'ADDON_TYPE', 'ADDON_PUBLISHER', 'ADDON_RELEASE_DATE', 'ADDON_RELEASE_TYPE', 'ADDON_RELEASE_NOTES', 'ADDON_DOWNLOAD_URL', 'ADDON_DOWNLOAD_PROGRESS', 'ADDON_DOWNLOAD_MD5', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('AddonId' => 0, 'StoreId' => 1, 'AddonName' => 2, 'AddonNick' => 3, 'AddonDownloadFilename' => 4, 'AddonDescription' => 5, 'AddonState' => 6, 'AddonStateChanged' => 7, 'AddonStatus' => 8, 'AddonVersion' => 9, 'AddonType' => 10, 'AddonPublisher' => 11, 'AddonReleaseDate' => 12, 'AddonReleaseType' => 13, 'AddonReleaseNotes' => 14, 'AddonDownloadUrl' => 15, 'AddonDownloadProgress' => 16, 'AddonDownloadMd5' => 17, ),
BasePeer::TYPE_COLNAME => array (AddonsManagerPeer::ADDON_ID => 0, AddonsManagerPeer::STORE_ID => 1, AddonsManagerPeer::ADDON_NAME => 2, AddonsManagerPeer::ADDON_NICK => 3, AddonsManagerPeer::ADDON_DOWNLOAD_FILENAME => 4, AddonsManagerPeer::ADDON_DESCRIPTION => 5, AddonsManagerPeer::ADDON_STATE => 6, AddonsManagerPeer::ADDON_STATE_CHANGED => 7, AddonsManagerPeer::ADDON_STATUS => 8, AddonsManagerPeer::ADDON_VERSION => 9, AddonsManagerPeer::ADDON_TYPE => 10, AddonsManagerPeer::ADDON_PUBLISHER => 11, AddonsManagerPeer::ADDON_RELEASE_DATE => 12, AddonsManagerPeer::ADDON_RELEASE_TYPE => 13, AddonsManagerPeer::ADDON_RELEASE_NOTES => 14, AddonsManagerPeer::ADDON_DOWNLOAD_URL => 15, AddonsManagerPeer::ADDON_DOWNLOAD_PROGRESS => 16, AddonsManagerPeer::ADDON_DOWNLOAD_MD5 => 17, ),
BasePeer::TYPE_FIELDNAME => array ('ADDON_ID' => 0, 'STORE_ID' => 1, 'ADDON_NAME' => 2, 'ADDON_NICK' => 3, 'ADDON_DOWNLOAD_FILENAME' => 4, 'ADDON_DESCRIPTION' => 5, 'ADDON_STATE' => 6, 'ADDON_STATE_CHANGED' => 7, 'ADDON_STATUS' => 8, 'ADDON_VERSION' => 9, 'ADDON_TYPE' => 10, 'ADDON_PUBLISHER' => 11, 'ADDON_RELEASE_DATE' => 12, 'ADDON_RELEASE_TYPE' => 13, 'ADDON_RELEASE_NOTES' => 14, 'ADDON_DOWNLOAD_URL' => 15, 'ADDON_DOWNLOAD_PROGRESS' => 16, 'ADDON_DOWNLOAD_MD5' => 17, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, )
);
/**
* @return MapBuilder the map builder for this peer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getMapBuilder()
{
include_once 'classes/model/map/AddonsManagerMapBuilder.php';
return BasePeer::getMapBuilder('classes.model.map.AddonsManagerMapBuilder');
}
/**
* Gets a map (hash) of PHP names to DB column names.
*
* @return array The PHP to DB name map for this peer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @deprecated Use the getFieldNames() and translateFieldName() methods instead of this.
*/
public static function getPhpNameMap()
{
if (self::$phpNameMap === null) {
$map = AddonsManagerPeer::getTableMap();
$columns = $map->getColumns();
$nameMap = array();
foreach ($columns as $column) {
$nameMap[$column->getPhpName()] = $column->getColumnName();
}
self::$phpNameMap = $nameMap;
}
return self::$phpNameMap;
}
/**
* Translates a fieldname to another type
*
* @param string $name field name
* @param string $fromType One of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @param string $toType One of the class type constants
* @return string translated name of the field.
*/
static public function translateFieldName($name, $fromType, $toType)
{
$toNames = self::getFieldNames($toType);
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
if ($key === null) {
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
/**
* Returns an array of of field names.
*
* @param string $type The type of fieldnames to return:
* One of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @return array A list of field names
*/
static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, self::$fieldNames)) {
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
}
return self::$fieldNames[$type];
}
/**
* Convenience method which changes table.column to alias.column.
*
* Using this method you can maintain SQL abstraction while using column aliases.
* <code>
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
* </code>
* @param string $alias The alias for the current table.
* @param string $column The column name for current table. (i.e. AddonsManagerPeer::COLUMN_NAME).
* @return string
*/
public static function alias($alias, $column)
{
return str_replace(AddonsManagerPeer::TABLE_NAME.'.', $alias.'.', $column);
}
/**
* Add all the columns needed to create a new object.
*
* Note: any columns that were marked with lazyLoad="true" in the
* XML schema will not be added to the select list and only loaded
* on demand.
*
* @param criteria object containing the columns to add.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function addSelectColumns(Criteria $criteria)
{
$criteria->addSelectColumn(AddonsManagerPeer::ADDON_ID);
$criteria->addSelectColumn(AddonsManagerPeer::STORE_ID);
$criteria->addSelectColumn(AddonsManagerPeer::ADDON_NAME);
$criteria->addSelectColumn(AddonsManagerPeer::ADDON_NICK);
$criteria->addSelectColumn(AddonsManagerPeer::ADDON_DOWNLOAD_FILENAME);
$criteria->addSelectColumn(AddonsManagerPeer::ADDON_DESCRIPTION);
$criteria->addSelectColumn(AddonsManagerPeer::ADDON_STATE);
$criteria->addSelectColumn(AddonsManagerPeer::ADDON_STATE_CHANGED);
$criteria->addSelectColumn(AddonsManagerPeer::ADDON_STATUS);
$criteria->addSelectColumn(AddonsManagerPeer::ADDON_VERSION);
$criteria->addSelectColumn(AddonsManagerPeer::ADDON_TYPE);
$criteria->addSelectColumn(AddonsManagerPeer::ADDON_PUBLISHER);
$criteria->addSelectColumn(AddonsManagerPeer::ADDON_RELEASE_DATE);
$criteria->addSelectColumn(AddonsManagerPeer::ADDON_RELEASE_TYPE);
$criteria->addSelectColumn(AddonsManagerPeer::ADDON_RELEASE_NOTES);
$criteria->addSelectColumn(AddonsManagerPeer::ADDON_DOWNLOAD_URL);
$criteria->addSelectColumn(AddonsManagerPeer::ADDON_DOWNLOAD_PROGRESS);
$criteria->addSelectColumn(AddonsManagerPeer::ADDON_DOWNLOAD_MD5);
}
const COUNT = 'COUNT(ADDONS_MANAGER.ADDON_ID)';
const COUNT_DISTINCT = 'COUNT(DISTINCT ADDONS_MANAGER.ADDON_ID)';
/**
* Returns the number of rows matching criteria.
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
* @param Connection $con
* @return int Number of matching rows.
*/
public static function doCount(Criteria $criteria, $distinct = false, $con = null)
{
// we're going to modify criteria, so copy it first
$criteria = clone $criteria;
// clear out anything that might confuse the ORDER BY clause
$criteria->clearSelectColumns()->clearOrderByColumns();
if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->addSelectColumn(AddonsManagerPeer::COUNT_DISTINCT);
} else {
$criteria->addSelectColumn(AddonsManagerPeer::COUNT);
}
// just in case we're grouping: add those columns to the select statement
foreach ($criteria->getGroupByColumns() as $column) {
$criteria->addSelectColumn($column);
}
$rs = AddonsManagerPeer::doSelectRS($criteria, $con);
if ($rs->next()) {
return $rs->getInt(1);
} else {
// no rows returned; we infer that means 0 matches.
return 0;
}
}
/**
* Method to select one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param Connection $con
* @return AddonsManager
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectOne(Criteria $criteria, $con = null)
{
$critcopy = clone $criteria;
$critcopy->setLimit(1);
$objects = AddonsManagerPeer::doSelect($critcopy, $con);
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Method to do selects.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param Connection $con
* @return array Array of selected Objects
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelect(Criteria $criteria, $con = null)
{
return AddonsManagerPeer::populateObjects(AddonsManagerPeer::doSelectRS($criteria, $con));
}
/**
* Prepares the Criteria object and uses the parent doSelect()
* method to get a ResultSet.
*
* Use this method directly if you want to just get the resultset
* (instead of an array of objects).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param Connection $con the connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return ResultSet The resultset object with numerically-indexed fields.
* @see BasePeer::doSelect()
*/
public static function doSelectRS(Criteria $criteria, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
if (!$criteria->getSelectColumns()) {
$criteria = clone $criteria;
AddonsManagerPeer::addSelectColumns($criteria);
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
// BasePeer returns a Creole ResultSet, set to return
// rows indexed numerically.
return BasePeer::doSelect($criteria, $con);
}
/**
* The returned array will contain objects of the default type or
* objects that inherit from the default.
*
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function populateObjects(ResultSet $rs)
{
$results = array();
// set the class once to avoid overhead in the loop
$cls = AddonsManagerPeer::getOMClass();
$cls = Propel::import($cls);
// populate the object(s)
while ($rs->next()) {
$obj = new $cls();
$obj->hydrate($rs);
$results[] = $obj;
}
return $results;
}
/**
* Returns the TableMap related to this peer.
* This method is not needed for general use but a specific application could have a need.
* @return TableMap
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
}
/**
* The class that the Peer will make instances of.
*
* This uses a dot-path notation which is tranalted into a path
* relative to a location on the PHP include_path.
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
*
* @return string path.to.ClassName
*/
public static function getOMClass()
{
return AddonsManagerPeer::CLASS_DEFAULT;
}
/**
* Method perform an INSERT on the database, given a AddonsManager or Criteria object.
*
* @param mixed $values Criteria or AddonsManager object containing data that is used to create the INSERT statement.
* @param Connection $con the connection to use
* @return mixed The new primary key.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doInsert($values, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} else {
$criteria = $values->buildCriteria(); // build Criteria from AddonsManager object
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->begin();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
return $pk;
}
/**
* Method perform an UPDATE on the database, given a AddonsManager or Criteria object.
*
* @param mixed $values Criteria or AddonsManager object containing data create the UPDATE statement.
* @param Connection $con The connection to use (specify Connection exert more control over transactions).
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doUpdate($values, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(AddonsManagerPeer::ADDON_ID);
$selectCriteria->add(AddonsManagerPeer::ADDON_ID, $criteria->remove(AddonsManagerPeer::ADDON_ID), $comparison);
$comparison = $criteria->getComparison(AddonsManagerPeer::STORE_ID);
$selectCriteria->add(AddonsManagerPeer::STORE_ID, $criteria->remove(AddonsManagerPeer::STORE_ID), $comparison);
} else {
$criteria = $values->buildCriteria(); // gets full criteria
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
}
// set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
* Method to DELETE all rows from the ADDONS_MANAGER table.
*
* @return int The number of affected rows (if supported by underlying database driver).
*/
public static function doDeleteAll($con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->begin();
$affectedRows += BasePeer::doDeleteAll(AddonsManagerPeer::TABLE_NAME, $con);
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
/**
* Method perform a DELETE on the database, given a AddonsManager or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or AddonsManager object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param Connection $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
* This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doDelete($values, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(AddonsManagerPeer::DATABASE_NAME);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} elseif ($values instanceof AddonsManager) {
$criteria = $values->buildPkeyCriteria();
} else {
// it must be the primary key
$criteria = new Criteria(self::DATABASE_NAME);
// primary key is composite; we therefore, expect
// the primary key passed to be an array of pkey
// values
if (count($values) == count($values, COUNT_RECURSIVE)) {
// array is not multi-dimensional
$values = array($values);
}
$vals = array();
foreach ($values as $value) {
$vals[0][] = $value[0];
$vals[1][] = $value[1];
}
$criteria->add(AddonsManagerPeer::ADDON_ID, $vals[0], Criteria::IN);
$criteria->add(AddonsManagerPeer::STORE_ID, $vals[1], Criteria::IN);
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->begin();
$affectedRows += BasePeer::doDelete($criteria, $con);
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
/**
* Validates all modified columns of given AddonsManager object.
* If parameter $columns is either a single column name or an array of column names
* than only those columns are validated.
*
* NOTICE: This does not apply to primary or foreign keys for now.
*
* @param AddonsManager $obj The object to validate.
* @param mixed $cols Column name or array of column names.
*
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
*/
public static function doValidate(AddonsManager $obj, $cols = null)
{
$columns = array();
if ($cols) {
$dbMap = Propel::getDatabaseMap(AddonsManagerPeer::DATABASE_NAME);
$tableMap = $dbMap->getTable(AddonsManagerPeer::TABLE_NAME);
if (! is_array($cols)) {
$cols = array($cols);
}
foreach ($cols as $colName) {
if ($tableMap->containsColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
}
} else {
}
return BasePeer::doValidate(AddonsManagerPeer::DATABASE_NAME, AddonsManagerPeer::TABLE_NAME, $columns);
}
/**
* Retrieve object using using composite pkey values.
* @param string $addon_id
* @param string $store_id
* @param Connection $con
* @return AddonsManager
*/
public static function retrieveByPK($addon_id, $store_id, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$criteria = new Criteria();
$criteria->add(AddonsManagerPeer::ADDON_ID, $addon_id);
$criteria->add(AddonsManagerPeer::STORE_ID, $store_id);
$v = AddonsManagerPeer::doSelect($criteria, $con);
return !empty($v) ? $v[0] : null;
}
}
// static code to register the map builder for this Peer with the main Propel class
if (Propel::isInit()) {
// the MapBuilder classes register themselves with Propel during initialization
// so we need to load them here.
try {
BaseAddonsManagerPeer::getMapBuilder();
} catch (Exception $e) {
Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
}
} else {
// even if Propel is not yet initialized, the map builder class can be registered
// now and then it will be loaded when Propel initializes.
require_once 'classes/model/map/AddonsManagerMapBuilder.php';
Propel::registerMapBuilder('classes.model.map.AddonsManagerMapBuilder');
}

View File

@@ -1,770 +0,0 @@
<?php
require_once 'propel/om/BaseObject.php';
require_once 'propel/om/Persistent.php';
include_once 'propel/util/Criteria.php';
include_once 'classes/model/AddonsStorePeer.php';
/**
* Base class that represents a row from the 'ADDONS_STORE' table.
*
*
*
* @package workflow.classes.model.om
*/
abstract class BaseAddonsStore extends BaseObject implements Persistent
{
/**
* The Peer class.
* Instance provides a convenient way of calling static methods on a class
* that calling code may not be able to identify.
* @var AddonsStorePeer
*/
protected static $peer;
/**
* The value for the store_id field.
* @var string
*/
protected $store_id;
/**
* The value for the store_version field.
* @var int
*/
protected $store_version;
/**
* The value for the store_location field.
* @var string
*/
protected $store_location;
/**
* The value for the store_type field.
* @var string
*/
protected $store_type;
/**
* The value for the store_last_updated field.
* @var int
*/
protected $store_last_updated;
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
* @var boolean
*/
protected $alreadyInSave = false;
/**
* Flag to prevent endless validation loop, if this object is referenced
* by another object which falls in this transaction.
* @var boolean
*/
protected $alreadyInValidation = false;
/**
* Get the [store_id] column value.
*
* @return string
*/
public function getStoreId()
{
return $this->store_id;
}
/**
* Get the [store_version] column value.
*
* @return int
*/
public function getStoreVersion()
{
return $this->store_version;
}
/**
* Get the [store_location] column value.
*
* @return string
*/
public function getStoreLocation()
{
return $this->store_location;
}
/**
* Get the [store_type] column value.
*
* @return string
*/
public function getStoreType()
{
return $this->store_type;
}
/**
* Get the [optionally formatted] [store_last_updated] column value.
*
* @param string $format The date/time format string (either date()-style or strftime()-style).
* If format is NULL, then the integer unix timestamp will be returned.
* @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL).
* @throws PropelException - if unable to convert the date/time to timestamp.
*/
public function getStoreLastUpdated($format = 'Y-m-d H:i:s')
{
if ($this->store_last_updated === null || $this->store_last_updated === '') {
return null;
} elseif (!is_int($this->store_last_updated)) {
// a non-timestamp value was set externally, so we convert it
$ts = strtotime($this->store_last_updated);
if ($ts === -1 || $ts === false) {
throw new PropelException("Unable to parse value of [store_last_updated] as date/time value: " .
var_export($this->store_last_updated, true));
}
} else {
$ts = $this->store_last_updated;
}
if ($format === null) {
return $ts;
} elseif (strpos($format, '%') !== false) {
return strftime($format, $ts);
} else {
return date($format, $ts);
}
}
/**
* Set the value of [store_id] column.
*
* @param string $v new value
* @return void
*/
public function setStoreId($v)
{
// Since the native PHP type for this column is string,
// we will cast the input to a string (if it is not).
if ($v !== null && !is_string($v)) {
$v = (string) $v;
}
if ($this->store_id !== $v) {
$this->store_id = $v;
$this->modifiedColumns[] = AddonsStorePeer::STORE_ID;
}
} // setStoreId()
/**
* Set the value of [store_version] column.
*
* @param int $v new value
* @return void
*/
public function setStoreVersion($v)
{
// Since the native PHP type for this column is integer,
// we will cast the input value to an int (if it is not).
if ($v !== null && !is_int($v) && is_numeric($v)) {
$v = (int) $v;
}
if ($this->store_version !== $v) {
$this->store_version = $v;
$this->modifiedColumns[] = AddonsStorePeer::STORE_VERSION;
}
} // setStoreVersion()
/**
* Set the value of [store_location] column.
*
* @param string $v new value
* @return void
*/
public function setStoreLocation($v)
{
// Since the native PHP type for this column is string,
// we will cast the input to a string (if it is not).
if ($v !== null && !is_string($v)) {
$v = (string) $v;
}
if ($this->store_location !== $v) {
$this->store_location = $v;
$this->modifiedColumns[] = AddonsStorePeer::STORE_LOCATION;
}
} // setStoreLocation()
/**
* Set the value of [store_type] column.
*
* @param string $v new value
* @return void
*/
public function setStoreType($v)
{
// Since the native PHP type for this column is string,
// we will cast the input to a string (if it is not).
if ($v !== null && !is_string($v)) {
$v = (string) $v;
}
if ($this->store_type !== $v) {
$this->store_type = $v;
$this->modifiedColumns[] = AddonsStorePeer::STORE_TYPE;
}
} // setStoreType()
/**
* Set the value of [store_last_updated] column.
*
* @param int $v new value
* @return void
*/
public function setStoreLastUpdated($v)
{
if ($v !== null && !is_int($v)) {
$ts = strtotime($v);
//Date/time accepts null values
if ($v == '') {
$ts = null;
}
if ($ts === -1 || $ts === false) {
throw new PropelException("Unable to parse date/time value for [store_last_updated] from input: " .
var_export($v, true));
}
} else {
$ts = $v;
}
if ($this->store_last_updated !== $ts) {
$this->store_last_updated = $ts;
$this->modifiedColumns[] = AddonsStorePeer::STORE_LAST_UPDATED;
}
} // setStoreLastUpdated()
/**
* Hydrates (populates) the object variables with values from the database resultset.
*
* An offset (1-based "start column") is specified so that objects can be hydrated
* with a subset of the columns in the resultset rows. This is needed, for example,
* for results of JOIN queries where the resultset row includes columns from two or
* more tables.
*
* @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos.
* @param int $startcol 1-based offset column which indicates which restultset column to start with.
* @return int next starting column
* @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
*/
public function hydrate(ResultSet $rs, $startcol = 1)
{
try {
$this->store_id = $rs->getString($startcol + 0);
$this->store_version = $rs->getInt($startcol + 1);
$this->store_location = $rs->getString($startcol + 2);
$this->store_type = $rs->getString($startcol + 3);
$this->store_last_updated = $rs->getTimestamp($startcol + 4, null);
$this->resetModified();
$this->setNew(false);
// FIXME - using NUM_COLUMNS may be clearer.
return $startcol + 5; // 5 = AddonsStorePeer::NUM_COLUMNS - AddonsStorePeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating AddonsStore object", $e);
}
}
/**
* Removes this object from datastore and sets delete attribute.
*
* @param Connection $con
* @return void
* @throws PropelException
* @see BaseObject::setDeleted()
* @see BaseObject::isDeleted()
*/
public function delete($con = null)
{
if ($this->isDeleted()) {
throw new PropelException("This object has already been deleted.");
}
if ($con === null) {
$con = Propel::getConnection(AddonsStorePeer::DATABASE_NAME);
}
try {
$con->begin();
AddonsStorePeer::doDelete($this, $con);
$this->setDeleted(true);
$con->commit();
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
/**
* Stores the object in the database. If the object is new,
* it inserts it; otherwise an update is performed. This method
* wraps the doSave() worker method in a transaction.
*
* @param Connection $con
* @return int The number of rows affected by this insert/update
* @throws PropelException
* @see doSave()
*/
public function save($con = null)
{
if ($this->isDeleted()) {
throw new PropelException("You cannot save an object that has been deleted.");
}
if ($con === null) {
$con = Propel::getConnection(AddonsStorePeer::DATABASE_NAME);
}
try {
$con->begin();
$affectedRows = $this->doSave($con);
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
/**
* Stores the object in the database.
*
* If the object is new, it inserts it; otherwise an update is performed.
* All related objects are also updated in this method.
*
* @param Connection $con
* @return int The number of rows affected by this insert/update and any referring
* @throws PropelException
* @see save()
*/
protected function doSave($con)
{
$affectedRows = 0; // initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
// If this object has been modified, then save it to the database.
if ($this->isModified()) {
if ($this->isNew()) {
$pk = AddonsStorePeer::doInsert($this, $con);
$affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which
// should always be true here (even though technically
// BasePeer::doInsert() can insert multiple rows).
$this->setNew(false);
} else {
$affectedRows += AddonsStorePeer::doUpdate($this, $con);
}
$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
}
$this->alreadyInSave = false;
}
return $affectedRows;
} // doSave()
/**
* Array of ValidationFailed objects.
* @var array ValidationFailed[]
*/
protected $validationFailures = array();
/**
* Gets any ValidationFailed objects that resulted from last call to validate().
*
*
* @return array ValidationFailed[]
* @see validate()
*/
public function getValidationFailures()
{
return $this->validationFailures;
}
/**
* Validates the objects modified field values and all objects related to this table.
*
* If $columns is either a column name or an array of column names
* only those columns are validated.
*
* @param mixed $columns Column name or an array of column names.
* @return boolean Whether all columns pass validation.
* @see doValidate()
* @see getValidationFailures()
*/
public function validate($columns = null)
{
$res = $this->doValidate($columns);
if ($res === true) {
$this->validationFailures = array();
return true;
} else {
$this->validationFailures = $res;
return false;
}
}
/**
* This function performs the validation work for complex object models.
*
* In addition to checking the current object, all related objects will
* also be validated. If all pass then <code>true</code> is returned; otherwise
* an aggreagated array of ValidationFailed objects will be returned.
*
* @param array $columns Array of column names to validate.
* @return mixed <code>true</code> if all validations pass;
array of <code>ValidationFailed</code> objects otherwise.
*/
protected function doValidate($columns = null)
{
if (!$this->alreadyInValidation) {
$this->alreadyInValidation = true;
$retval = null;
$failureMap = array();
if (($retval = AddonsStorePeer::doValidate($this, $columns)) !== true) {
$failureMap = array_merge($failureMap, $retval);
}
$this->alreadyInValidation = false;
}
return (!empty($failureMap) ? $failureMap : true);
}
/**
* Retrieves a field from the object by name passed in as a string.
*
* @param string $name name
* @param string $type The type of fieldname the $name is of:
* one of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @return mixed Value of field.
*/
public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
{
$pos = AddonsStorePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
return $this->getByPosition($pos);
}
/**
* Retrieves a field from the object by Position as specified in the xml schema.
* Zero-based.
*
* @param int $pos position in xml schema
* @return mixed Value of field at $pos
*/
public function getByPosition($pos)
{
switch($pos) {
case 0:
return $this->getStoreId();
break;
case 1:
return $this->getStoreVersion();
break;
case 2:
return $this->getStoreLocation();
break;
case 3:
return $this->getStoreType();
break;
case 4:
return $this->getStoreLastUpdated();
break;
default:
return null;
break;
} // switch()
}
/**
* Exports the object as an array.
*
* You can specify the key type of the array by passing one of the class
* type constants.
*
* @param string $keyType One of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @return an associative array containing the field names (as keys) and field values
*/
public function toArray($keyType = BasePeer::TYPE_PHPNAME)
{
$keys = AddonsStorePeer::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getStoreId(),
$keys[1] => $this->getStoreVersion(),
$keys[2] => $this->getStoreLocation(),
$keys[3] => $this->getStoreType(),
$keys[4] => $this->getStoreLastUpdated(),
);
return $result;
}
/**
* Sets a field from the object by name passed in as a string.
*
* @param string $name peer name
* @param mixed $value field value
* @param string $type The type of fieldname the $name is of:
* one of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @return void
*/
public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
{
$pos = AddonsStorePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
return $this->setByPosition($pos, $value);
}
/**
* Sets a field from the object by Position as specified in the xml schema.
* Zero-based.
*
* @param int $pos position in xml schema
* @param mixed $value field value
* @return void
*/
public function setByPosition($pos, $value)
{
switch($pos) {
case 0:
$this->setStoreId($value);
break;
case 1:
$this->setStoreVersion($value);
break;
case 2:
$this->setStoreLocation($value);
break;
case 3:
$this->setStoreType($value);
break;
case 4:
$this->setStoreLastUpdated($value);
break;
} // switch()
}
/**
* Populates the object using an array.
*
* This is particularly useful when populating an object from one of the
* request arrays (e.g. $_POST). This method goes through the column
* names, checking to see whether a matching key exists in populated
* array. If so the setByName() method is called for that column.
*
* You can specify the key type of the array by additionally passing one
* of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME,
* TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId')
*
* @param array $arr An array to populate the object from.
* @param string $keyType The type of keys the array uses.
* @return void
*/
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
{
$keys = AddonsStorePeer::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) {
$this->setStoreId($arr[$keys[0]]);
}
if (array_key_exists($keys[1], $arr)) {
$this->setStoreVersion($arr[$keys[1]]);
}
if (array_key_exists($keys[2], $arr)) {
$this->setStoreLocation($arr[$keys[2]]);
}
if (array_key_exists($keys[3], $arr)) {
$this->setStoreType($arr[$keys[3]]);
}
if (array_key_exists($keys[4], $arr)) {
$this->setStoreLastUpdated($arr[$keys[4]]);
}
}
/**
* Build a Criteria object containing the values of all modified columns in this object.
*
* @return Criteria The Criteria object containing all modified values.
*/
public function buildCriteria()
{
$criteria = new Criteria(AddonsStorePeer::DATABASE_NAME);
if ($this->isColumnModified(AddonsStorePeer::STORE_ID)) {
$criteria->add(AddonsStorePeer::STORE_ID, $this->store_id);
}
if ($this->isColumnModified(AddonsStorePeer::STORE_VERSION)) {
$criteria->add(AddonsStorePeer::STORE_VERSION, $this->store_version);
}
if ($this->isColumnModified(AddonsStorePeer::STORE_LOCATION)) {
$criteria->add(AddonsStorePeer::STORE_LOCATION, $this->store_location);
}
if ($this->isColumnModified(AddonsStorePeer::STORE_TYPE)) {
$criteria->add(AddonsStorePeer::STORE_TYPE, $this->store_type);
}
if ($this->isColumnModified(AddonsStorePeer::STORE_LAST_UPDATED)) {
$criteria->add(AddonsStorePeer::STORE_LAST_UPDATED, $this->store_last_updated);
}
return $criteria;
}
/**
* Builds a Criteria object containing the primary key for this object.
*
* Unlike buildCriteria() this method includes the primary key values regardless
* of whether or not they have been modified.
*
* @return Criteria The Criteria object containing value(s) for primary key(s).
*/
public function buildPkeyCriteria()
{
$criteria = new Criteria(AddonsStorePeer::DATABASE_NAME);
$criteria->add(AddonsStorePeer::STORE_ID, $this->store_id);
return $criteria;
}
/**
* Returns the primary key for this object (row).
* @return string
*/
public function getPrimaryKey()
{
return $this->getStoreId();
}
/**
* Generic method to set the primary key (store_id column).
*
* @param string $key Primary key.
* @return void
*/
public function setPrimaryKey($key)
{
$this->setStoreId($key);
}
/**
* Sets contents of passed object to values from current object.
*
* If desired, this method can also make copies of all associated (fkey referrers)
* objects.
*
* @param object $copyObj An object of AddonsStore (or compatible) type.
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
* @throws PropelException
*/
public function copyInto($copyObj, $deepCopy = false)
{
$copyObj->setStoreVersion($this->store_version);
$copyObj->setStoreLocation($this->store_location);
$copyObj->setStoreType($this->store_type);
$copyObj->setStoreLastUpdated($this->store_last_updated);
$copyObj->setNew(true);
$copyObj->setStoreId(NULL); // this is a pkey column, so set to default value
}
/**
* Makes a copy of this object that will be inserted as a new row in table when saved.
* It creates a new object filling in the simple attributes, but skipping any primary
* keys that are defined for the table.
*
* If desired, this method can also make copies of all associated (fkey referrers)
* objects.
*
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
* @return AddonsStore Clone of current object.
* @throws PropelException
*/
public function copy($deepCopy = false)
{
// we use get_class(), because this might be a subclass
$clazz = get_class($this);
$copyObj = new $clazz();
$this->copyInto($copyObj, $deepCopy);
return $copyObj;
}
/**
* Returns a peer instance associated with this om.
*
* Since Peer classes are not to have any instance attributes, this method returns the
* same instance for all member of this class. The method could therefore
* be static, but this would prevent one from overriding the behavior.
*
* @return AddonsStorePeer
*/
public function getPeer()
{
if (self::$peer === null) {
self::$peer = new AddonsStorePeer();
}
return self::$peer;
}
}

View File

@@ -1,587 +0,0 @@
<?php
require_once 'propel/util/BasePeer.php';
// The object class -- needed for instanceof checks in this class.
// actual class may be a subclass -- as returned by AddonsStorePeer::getOMClass()
include_once 'classes/model/AddonsStore.php';
/**
* Base static class for performing query and update operations on the 'ADDONS_STORE' table.
*
*
*
* @package workflow.classes.model.om
*/
abstract class BaseAddonsStorePeer
{
/** the default database name for this class */
const DATABASE_NAME = 'workflow';
/** the table name for this class */
const TABLE_NAME = 'ADDONS_STORE';
/** A class that can be returned by this peer. */
const CLASS_DEFAULT = 'classes.model.AddonsStore';
/** The total number of columns. */
const NUM_COLUMNS = 5;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the STORE_ID field */
const STORE_ID = 'ADDONS_STORE.STORE_ID';
/** the column name for the STORE_VERSION field */
const STORE_VERSION = 'ADDONS_STORE.STORE_VERSION';
/** the column name for the STORE_LOCATION field */
const STORE_LOCATION = 'ADDONS_STORE.STORE_LOCATION';
/** the column name for the STORE_TYPE field */
const STORE_TYPE = 'ADDONS_STORE.STORE_TYPE';
/** the column name for the STORE_LAST_UPDATED field */
const STORE_LAST_UPDATED = 'ADDONS_STORE.STORE_LAST_UPDATED';
/** The PHP to DB Name Mapping */
private static $phpNameMap = null;
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('StoreId', 'StoreVersion', 'StoreLocation', 'StoreType', 'StoreLastUpdated', ),
BasePeer::TYPE_COLNAME => array (AddonsStorePeer::STORE_ID, AddonsStorePeer::STORE_VERSION, AddonsStorePeer::STORE_LOCATION, AddonsStorePeer::STORE_TYPE, AddonsStorePeer::STORE_LAST_UPDATED, ),
BasePeer::TYPE_FIELDNAME => array ('STORE_ID', 'STORE_VERSION', 'STORE_LOCATION', 'STORE_TYPE', 'STORE_LAST_UPDATED', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('StoreId' => 0, 'StoreVersion' => 1, 'StoreLocation' => 2, 'StoreType' => 3, 'StoreLastUpdated' => 4, ),
BasePeer::TYPE_COLNAME => array (AddonsStorePeer::STORE_ID => 0, AddonsStorePeer::STORE_VERSION => 1, AddonsStorePeer::STORE_LOCATION => 2, AddonsStorePeer::STORE_TYPE => 3, AddonsStorePeer::STORE_LAST_UPDATED => 4, ),
BasePeer::TYPE_FIELDNAME => array ('STORE_ID' => 0, 'STORE_VERSION' => 1, 'STORE_LOCATION' => 2, 'STORE_TYPE' => 3, 'STORE_LAST_UPDATED' => 4, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
);
/**
* @return MapBuilder the map builder for this peer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getMapBuilder()
{
include_once 'classes/model/map/AddonsStoreMapBuilder.php';
return BasePeer::getMapBuilder('classes.model.map.AddonsStoreMapBuilder');
}
/**
* Gets a map (hash) of PHP names to DB column names.
*
* @return array The PHP to DB name map for this peer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @deprecated Use the getFieldNames() and translateFieldName() methods instead of this.
*/
public static function getPhpNameMap()
{
if (self::$phpNameMap === null) {
$map = AddonsStorePeer::getTableMap();
$columns = $map->getColumns();
$nameMap = array();
foreach ($columns as $column) {
$nameMap[$column->getPhpName()] = $column->getColumnName();
}
self::$phpNameMap = $nameMap;
}
return self::$phpNameMap;
}
/**
* Translates a fieldname to another type
*
* @param string $name field name
* @param string $fromType One of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @param string $toType One of the class type constants
* @return string translated name of the field.
*/
static public function translateFieldName($name, $fromType, $toType)
{
$toNames = self::getFieldNames($toType);
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
if ($key === null) {
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
/**
* Returns an array of of field names.
*
* @param string $type The type of fieldnames to return:
* One of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @return array A list of field names
*/
static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, self::$fieldNames)) {
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
}
return self::$fieldNames[$type];
}
/**
* Convenience method which changes table.column to alias.column.
*
* Using this method you can maintain SQL abstraction while using column aliases.
* <code>
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
* </code>
* @param string $alias The alias for the current table.
* @param string $column The column name for current table. (i.e. AddonsStorePeer::COLUMN_NAME).
* @return string
*/
public static function alias($alias, $column)
{
return str_replace(AddonsStorePeer::TABLE_NAME.'.', $alias.'.', $column);
}
/**
* Add all the columns needed to create a new object.
*
* Note: any columns that were marked with lazyLoad="true" in the
* XML schema will not be added to the select list and only loaded
* on demand.
*
* @param criteria object containing the columns to add.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function addSelectColumns(Criteria $criteria)
{
$criteria->addSelectColumn(AddonsStorePeer::STORE_ID);
$criteria->addSelectColumn(AddonsStorePeer::STORE_VERSION);
$criteria->addSelectColumn(AddonsStorePeer::STORE_LOCATION);
$criteria->addSelectColumn(AddonsStorePeer::STORE_TYPE);
$criteria->addSelectColumn(AddonsStorePeer::STORE_LAST_UPDATED);
}
const COUNT = 'COUNT(ADDONS_STORE.STORE_ID)';
const COUNT_DISTINCT = 'COUNT(DISTINCT ADDONS_STORE.STORE_ID)';
/**
* Returns the number of rows matching criteria.
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
* @param Connection $con
* @return int Number of matching rows.
*/
public static function doCount(Criteria $criteria, $distinct = false, $con = null)
{
// we're going to modify criteria, so copy it first
$criteria = clone $criteria;
// clear out anything that might confuse the ORDER BY clause
$criteria->clearSelectColumns()->clearOrderByColumns();
if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->addSelectColumn(AddonsStorePeer::COUNT_DISTINCT);
} else {
$criteria->addSelectColumn(AddonsStorePeer::COUNT);
}
// just in case we're grouping: add those columns to the select statement
foreach ($criteria->getGroupByColumns() as $column) {
$criteria->addSelectColumn($column);
}
$rs = AddonsStorePeer::doSelectRS($criteria, $con);
if ($rs->next()) {
return $rs->getInt(1);
} else {
// no rows returned; we infer that means 0 matches.
return 0;
}
}
/**
* Method to select one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param Connection $con
* @return AddonsStore
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectOne(Criteria $criteria, $con = null)
{
$critcopy = clone $criteria;
$critcopy->setLimit(1);
$objects = AddonsStorePeer::doSelect($critcopy, $con);
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Method to do selects.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param Connection $con
* @return array Array of selected Objects
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelect(Criteria $criteria, $con = null)
{
return AddonsStorePeer::populateObjects(AddonsStorePeer::doSelectRS($criteria, $con));
}
/**
* Prepares the Criteria object and uses the parent doSelect()
* method to get a ResultSet.
*
* Use this method directly if you want to just get the resultset
* (instead of an array of objects).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param Connection $con the connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return ResultSet The resultset object with numerically-indexed fields.
* @see BasePeer::doSelect()
*/
public static function doSelectRS(Criteria $criteria, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
if (!$criteria->getSelectColumns()) {
$criteria = clone $criteria;
AddonsStorePeer::addSelectColumns($criteria);
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
// BasePeer returns a Creole ResultSet, set to return
// rows indexed numerically.
return BasePeer::doSelect($criteria, $con);
}
/**
* The returned array will contain objects of the default type or
* objects that inherit from the default.
*
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function populateObjects(ResultSet $rs)
{
$results = array();
// set the class once to avoid overhead in the loop
$cls = AddonsStorePeer::getOMClass();
$cls = Propel::import($cls);
// populate the object(s)
while ($rs->next()) {
$obj = new $cls();
$obj->hydrate($rs);
$results[] = $obj;
}
return $results;
}
/**
* Returns the TableMap related to this peer.
* This method is not needed for general use but a specific application could have a need.
* @return TableMap
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
}
/**
* The class that the Peer will make instances of.
*
* This uses a dot-path notation which is tranalted into a path
* relative to a location on the PHP include_path.
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
*
* @return string path.to.ClassName
*/
public static function getOMClass()
{
return AddonsStorePeer::CLASS_DEFAULT;
}
/**
* Method perform an INSERT on the database, given a AddonsStore or Criteria object.
*
* @param mixed $values Criteria or AddonsStore object containing data that is used to create the INSERT statement.
* @param Connection $con the connection to use
* @return mixed The new primary key.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doInsert($values, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} else {
$criteria = $values->buildCriteria(); // build Criteria from AddonsStore object
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->begin();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
return $pk;
}
/**
* Method perform an UPDATE on the database, given a AddonsStore or Criteria object.
*
* @param mixed $values Criteria or AddonsStore object containing data create the UPDATE statement.
* @param Connection $con The connection to use (specify Connection exert more control over transactions).
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doUpdate($values, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(AddonsStorePeer::STORE_ID);
$selectCriteria->add(AddonsStorePeer::STORE_ID, $criteria->remove(AddonsStorePeer::STORE_ID), $comparison);
} else {
$criteria = $values->buildCriteria(); // gets full criteria
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
}
// set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
* Method to DELETE all rows from the ADDONS_STORE table.
*
* @return int The number of affected rows (if supported by underlying database driver).
*/
public static function doDeleteAll($con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->begin();
$affectedRows += BasePeer::doDeleteAll(AddonsStorePeer::TABLE_NAME, $con);
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
/**
* Method perform a DELETE on the database, given a AddonsStore or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or AddonsStore object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param Connection $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
* This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doDelete($values, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(AddonsStorePeer::DATABASE_NAME);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} elseif ($values instanceof AddonsStore) {
$criteria = $values->buildPkeyCriteria();
} else {
// it must be the primary key
$criteria = new Criteria(self::DATABASE_NAME);
$criteria->add(AddonsStorePeer::STORE_ID, (array) $values, Criteria::IN);
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->begin();
$affectedRows += BasePeer::doDelete($criteria, $con);
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
/**
* Validates all modified columns of given AddonsStore object.
* If parameter $columns is either a single column name or an array of column names
* than only those columns are validated.
*
* NOTICE: This does not apply to primary or foreign keys for now.
*
* @param AddonsStore $obj The object to validate.
* @param mixed $cols Column name or array of column names.
*
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
*/
public static function doValidate(AddonsStore $obj, $cols = null)
{
$columns = array();
if ($cols) {
$dbMap = Propel::getDatabaseMap(AddonsStorePeer::DATABASE_NAME);
$tableMap = $dbMap->getTable(AddonsStorePeer::TABLE_NAME);
if (! is_array($cols)) {
$cols = array($cols);
}
foreach ($cols as $colName) {
if ($tableMap->containsColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
}
} else {
}
return BasePeer::doValidate(AddonsStorePeer::DATABASE_NAME, AddonsStorePeer::TABLE_NAME, $columns);
}
/**
* Retrieve a single object by pkey.
*
* @param mixed $pk the primary key.
* @param Connection $con the connection to use
* @return AddonsStore
*/
public static function retrieveByPK($pk, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$criteria = new Criteria(AddonsStorePeer::DATABASE_NAME);
$criteria->add(AddonsStorePeer::STORE_ID, $pk);
$v = AddonsStorePeer::doSelect($criteria, $con);
return !empty($v) > 0 ? $v[0] : null;
}
/**
* Retrieve multiple objects by pkey.
*
* @param array $pks List of primary keys
* @param Connection $con the connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function retrieveByPKs($pks, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria();
$criteria->add(AddonsStorePeer::STORE_ID, $pks, Criteria::IN);
$objs = AddonsStorePeer::doSelect($criteria, $con);
}
return $objs;
}
}
// static code to register the map builder for this Peer with the main Propel class
if (Propel::isInit()) {
// the MapBuilder classes register themselves with Propel during initialization
// so we need to load them here.
try {
BaseAddonsStorePeer::getMapBuilder();
} catch (Exception $e) {
Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
}
} else {
// even if Propel is not yet initialized, the map builder class can be registered
// now and then it will be loaded when Propel initializes.
require_once 'classes/model/map/AddonsStoreMapBuilder.php';
Propel::registerMapBuilder('classes.model.map.AddonsStoreMapBuilder');
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,612 +0,0 @@
<?php
require_once 'propel/util/BasePeer.php';
// The object class -- needed for instanceof checks in this class.
// actual class may be a subclass -- as returned by LicenseManagerPeer::getOMClass()
include_once 'classes/model/LicenseManager.php';
/**
* Base static class for performing query and update operations on the 'LICENSE_MANAGER' table.
*
*
*
* @package workflow.classes.model.om
*/
abstract class BaseLicenseManagerPeer
{
/** the default database name for this class */
const DATABASE_NAME = 'workflow';
/** the table name for this class */
const TABLE_NAME = 'LICENSE_MANAGER';
/** A class that can be returned by this peer. */
const CLASS_DEFAULT = 'classes.model.LicenseManager';
/** The total number of columns. */
const NUM_COLUMNS = 10;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the LICENSE_UID field */
const LICENSE_UID = 'LICENSE_MANAGER.LICENSE_UID';
/** the column name for the LICENSE_USER field */
const LICENSE_USER = 'LICENSE_MANAGER.LICENSE_USER';
/** the column name for the LICENSE_START field */
const LICENSE_START = 'LICENSE_MANAGER.LICENSE_START';
/** the column name for the LICENSE_END field */
const LICENSE_END = 'LICENSE_MANAGER.LICENSE_END';
/** the column name for the LICENSE_SPAN field */
const LICENSE_SPAN = 'LICENSE_MANAGER.LICENSE_SPAN';
/** the column name for the LICENSE_STATUS field */
const LICENSE_STATUS = 'LICENSE_MANAGER.LICENSE_STATUS';
/** the column name for the LICENSE_DATA field */
const LICENSE_DATA = 'LICENSE_MANAGER.LICENSE_DATA';
/** the column name for the LICENSE_PATH field */
const LICENSE_PATH = 'LICENSE_MANAGER.LICENSE_PATH';
/** the column name for the LICENSE_WORKSPACE field */
const LICENSE_WORKSPACE = 'LICENSE_MANAGER.LICENSE_WORKSPACE';
/** the column name for the LICENSE_TYPE field */
const LICENSE_TYPE = 'LICENSE_MANAGER.LICENSE_TYPE';
/** The PHP to DB Name Mapping */
private static $phpNameMap = null;
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('LicenseUid', 'LicenseUser', 'LicenseStart', 'LicenseEnd', 'LicenseSpan', 'LicenseStatus', 'LicenseData', 'LicensePath', 'LicenseWorkspace', 'LicenseType', ),
BasePeer::TYPE_COLNAME => array (LicenseManagerPeer::LICENSE_UID, LicenseManagerPeer::LICENSE_USER, LicenseManagerPeer::LICENSE_START, LicenseManagerPeer::LICENSE_END, LicenseManagerPeer::LICENSE_SPAN, LicenseManagerPeer::LICENSE_STATUS, LicenseManagerPeer::LICENSE_DATA, LicenseManagerPeer::LICENSE_PATH, LicenseManagerPeer::LICENSE_WORKSPACE, LicenseManagerPeer::LICENSE_TYPE, ),
BasePeer::TYPE_FIELDNAME => array ('LICENSE_UID', 'LICENSE_USER', 'LICENSE_START', 'LICENSE_END', 'LICENSE_SPAN', 'LICENSE_STATUS', 'LICENSE_DATA', 'LICENSE_PATH', 'LICENSE_WORKSPACE', 'LICENSE_TYPE', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('LicenseUid' => 0, 'LicenseUser' => 1, 'LicenseStart' => 2, 'LicenseEnd' => 3, 'LicenseSpan' => 4, 'LicenseStatus' => 5, 'LicenseData' => 6, 'LicensePath' => 7, 'LicenseWorkspace' => 8, 'LicenseType' => 9, ),
BasePeer::TYPE_COLNAME => array (LicenseManagerPeer::LICENSE_UID => 0, LicenseManagerPeer::LICENSE_USER => 1, LicenseManagerPeer::LICENSE_START => 2, LicenseManagerPeer::LICENSE_END => 3, LicenseManagerPeer::LICENSE_SPAN => 4, LicenseManagerPeer::LICENSE_STATUS => 5, LicenseManagerPeer::LICENSE_DATA => 6, LicenseManagerPeer::LICENSE_PATH => 7, LicenseManagerPeer::LICENSE_WORKSPACE => 8, LicenseManagerPeer::LICENSE_TYPE => 9, ),
BasePeer::TYPE_FIELDNAME => array ('LICENSE_UID' => 0, 'LICENSE_USER' => 1, 'LICENSE_START' => 2, 'LICENSE_END' => 3, 'LICENSE_SPAN' => 4, 'LICENSE_STATUS' => 5, 'LICENSE_DATA' => 6, 'LICENSE_PATH' => 7, 'LICENSE_WORKSPACE' => 8, 'LICENSE_TYPE' => 9, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
);
/**
* @return MapBuilder the map builder for this peer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getMapBuilder()
{
include_once 'classes/model/map/LicenseManagerMapBuilder.php';
return BasePeer::getMapBuilder('classes.model.map.LicenseManagerMapBuilder');
}
/**
* Gets a map (hash) of PHP names to DB column names.
*
* @return array The PHP to DB name map for this peer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @deprecated Use the getFieldNames() and translateFieldName() methods instead of this.
*/
public static function getPhpNameMap()
{
if (self::$phpNameMap === null) {
$map = LicenseManagerPeer::getTableMap();
$columns = $map->getColumns();
$nameMap = array();
foreach ($columns as $column) {
$nameMap[$column->getPhpName()] = $column->getColumnName();
}
self::$phpNameMap = $nameMap;
}
return self::$phpNameMap;
}
/**
* Translates a fieldname to another type
*
* @param string $name field name
* @param string $fromType One of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @param string $toType One of the class type constants
* @return string translated name of the field.
*/
static public function translateFieldName($name, $fromType, $toType)
{
$toNames = self::getFieldNames($toType);
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
if ($key === null) {
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
/**
* Returns an array of of field names.
*
* @param string $type The type of fieldnames to return:
* One of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @return array A list of field names
*/
static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, self::$fieldNames)) {
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
}
return self::$fieldNames[$type];
}
/**
* Convenience method which changes table.column to alias.column.
*
* Using this method you can maintain SQL abstraction while using column aliases.
* <code>
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
* </code>
* @param string $alias The alias for the current table.
* @param string $column The column name for current table. (i.e. LicenseManagerPeer::COLUMN_NAME).
* @return string
*/
public static function alias($alias, $column)
{
return str_replace(LicenseManagerPeer::TABLE_NAME.'.', $alias.'.', $column);
}
/**
* Add all the columns needed to create a new object.
*
* Note: any columns that were marked with lazyLoad="true" in the
* XML schema will not be added to the select list and only loaded
* on demand.
*
* @param criteria object containing the columns to add.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function addSelectColumns(Criteria $criteria)
{
$criteria->addSelectColumn(LicenseManagerPeer::LICENSE_UID);
$criteria->addSelectColumn(LicenseManagerPeer::LICENSE_USER);
$criteria->addSelectColumn(LicenseManagerPeer::LICENSE_START);
$criteria->addSelectColumn(LicenseManagerPeer::LICENSE_END);
$criteria->addSelectColumn(LicenseManagerPeer::LICENSE_SPAN);
$criteria->addSelectColumn(LicenseManagerPeer::LICENSE_STATUS);
$criteria->addSelectColumn(LicenseManagerPeer::LICENSE_DATA);
$criteria->addSelectColumn(LicenseManagerPeer::LICENSE_PATH);
$criteria->addSelectColumn(LicenseManagerPeer::LICENSE_WORKSPACE);
$criteria->addSelectColumn(LicenseManagerPeer::LICENSE_TYPE);
}
const COUNT = 'COUNT(LICENSE_MANAGER.LICENSE_UID)';
const COUNT_DISTINCT = 'COUNT(DISTINCT LICENSE_MANAGER.LICENSE_UID)';
/**
* Returns the number of rows matching criteria.
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
* @param Connection $con
* @return int Number of matching rows.
*/
public static function doCount(Criteria $criteria, $distinct = false, $con = null)
{
// we're going to modify criteria, so copy it first
$criteria = clone $criteria;
// clear out anything that might confuse the ORDER BY clause
$criteria->clearSelectColumns()->clearOrderByColumns();
if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->addSelectColumn(LicenseManagerPeer::COUNT_DISTINCT);
} else {
$criteria->addSelectColumn(LicenseManagerPeer::COUNT);
}
// just in case we're grouping: add those columns to the select statement
foreach ($criteria->getGroupByColumns() as $column) {
$criteria->addSelectColumn($column);
}
$rs = LicenseManagerPeer::doSelectRS($criteria, $con);
if ($rs->next()) {
return $rs->getInt(1);
} else {
// no rows returned; we infer that means 0 matches.
return 0;
}
}
/**
* Method to select one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param Connection $con
* @return LicenseManager
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectOne(Criteria $criteria, $con = null)
{
$critcopy = clone $criteria;
$critcopy->setLimit(1);
$objects = LicenseManagerPeer::doSelect($critcopy, $con);
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Method to do selects.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param Connection $con
* @return array Array of selected Objects
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelect(Criteria $criteria, $con = null)
{
return LicenseManagerPeer::populateObjects(LicenseManagerPeer::doSelectRS($criteria, $con));
}
/**
* Prepares the Criteria object and uses the parent doSelect()
* method to get a ResultSet.
*
* Use this method directly if you want to just get the resultset
* (instead of an array of objects).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param Connection $con the connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return ResultSet The resultset object with numerically-indexed fields.
* @see BasePeer::doSelect()
*/
public static function doSelectRS(Criteria $criteria, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
if (!$criteria->getSelectColumns()) {
$criteria = clone $criteria;
LicenseManagerPeer::addSelectColumns($criteria);
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
// BasePeer returns a Creole ResultSet, set to return
// rows indexed numerically.
return BasePeer::doSelect($criteria, $con);
}
/**
* The returned array will contain objects of the default type or
* objects that inherit from the default.
*
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function populateObjects(ResultSet $rs)
{
$results = array();
// set the class once to avoid overhead in the loop
$cls = LicenseManagerPeer::getOMClass();
$cls = Propel::import($cls);
// populate the object(s)
while ($rs->next()) {
$obj = new $cls();
$obj->hydrate($rs);
$results[] = $obj;
}
return $results;
}
/**
* Returns the TableMap related to this peer.
* This method is not needed for general use but a specific application could have a need.
* @return TableMap
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
}
/**
* The class that the Peer will make instances of.
*
* This uses a dot-path notation which is tranalted into a path
* relative to a location on the PHP include_path.
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
*
* @return string path.to.ClassName
*/
public static function getOMClass()
{
return LicenseManagerPeer::CLASS_DEFAULT;
}
/**
* Method perform an INSERT on the database, given a LicenseManager or Criteria object.
*
* @param mixed $values Criteria or LicenseManager object containing data that is used to create the INSERT statement.
* @param Connection $con the connection to use
* @return mixed The new primary key.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doInsert($values, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} else {
$criteria = $values->buildCriteria(); // build Criteria from LicenseManager object
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->begin();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
return $pk;
}
/**
* Method perform an UPDATE on the database, given a LicenseManager or Criteria object.
*
* @param mixed $values Criteria or LicenseManager object containing data create the UPDATE statement.
* @param Connection $con The connection to use (specify Connection exert more control over transactions).
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doUpdate($values, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(LicenseManagerPeer::LICENSE_UID);
$selectCriteria->add(LicenseManagerPeer::LICENSE_UID, $criteria->remove(LicenseManagerPeer::LICENSE_UID), $comparison);
} else {
$criteria = $values->buildCriteria(); // gets full criteria
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
}
// set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
* Method to DELETE all rows from the LICENSE_MANAGER table.
*
* @return int The number of affected rows (if supported by underlying database driver).
*/
public static function doDeleteAll($con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->begin();
$affectedRows += BasePeer::doDeleteAll(LicenseManagerPeer::TABLE_NAME, $con);
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
/**
* Method perform a DELETE on the database, given a LicenseManager or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or LicenseManager object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param Connection $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
* This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doDelete($values, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(LicenseManagerPeer::DATABASE_NAME);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} elseif ($values instanceof LicenseManager) {
$criteria = $values->buildPkeyCriteria();
} else {
// it must be the primary key
$criteria = new Criteria(self::DATABASE_NAME);
$criteria->add(LicenseManagerPeer::LICENSE_UID, (array) $values, Criteria::IN);
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->begin();
$affectedRows += BasePeer::doDelete($criteria, $con);
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
/**
* Validates all modified columns of given LicenseManager object.
* If parameter $columns is either a single column name or an array of column names
* than only those columns are validated.
*
* NOTICE: This does not apply to primary or foreign keys for now.
*
* @param LicenseManager $obj The object to validate.
* @param mixed $cols Column name or array of column names.
*
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
*/
public static function doValidate(LicenseManager $obj, $cols = null)
{
$columns = array();
if ($cols) {
$dbMap = Propel::getDatabaseMap(LicenseManagerPeer::DATABASE_NAME);
$tableMap = $dbMap->getTable(LicenseManagerPeer::TABLE_NAME);
if (! is_array($cols)) {
$cols = array($cols);
}
foreach ($cols as $colName) {
if ($tableMap->containsColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
}
} else {
}
return BasePeer::doValidate(LicenseManagerPeer::DATABASE_NAME, LicenseManagerPeer::TABLE_NAME, $columns);
}
/**
* Retrieve a single object by pkey.
*
* @param mixed $pk the primary key.
* @param Connection $con the connection to use
* @return LicenseManager
*/
public static function retrieveByPK($pk, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$criteria = new Criteria(LicenseManagerPeer::DATABASE_NAME);
$criteria->add(LicenseManagerPeer::LICENSE_UID, $pk);
$v = LicenseManagerPeer::doSelect($criteria, $con);
return !empty($v) > 0 ? $v[0] : null;
}
/**
* Retrieve multiple objects by pkey.
*
* @param array $pks List of primary keys
* @param Connection $con the connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function retrieveByPKs($pks, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria();
$criteria->add(LicenseManagerPeer::LICENSE_UID, $pks, Criteria::IN);
$objs = LicenseManagerPeer::doSelect($criteria, $con);
}
return $objs;
}
}
// static code to register the map builder for this Peer with the main Propel class
if (Propel::isInit()) {
// the MapBuilder classes register themselves with Propel during initialization
// so we need to load them here.
try {
BaseLicenseManagerPeer::getMapBuilder();
} catch (Exception $e) {
Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
}
} else {
// even if Propel is not yet initialized, the map builder class can be registered
// now and then it will be loaded when Propel initializes.
require_once 'classes/model/map/LicenseManagerMapBuilder.php';
Propel::registerMapBuilder('classes.model.map.LicenseManagerMapBuilder');
}