Object constructors shouldn't require an id if passed a $oRow object. Gets rid of

objectGetInstanceFromRow() since we can pass the row into the constructor instead.
This commit is contained in:
Alexander Nicolaysen Sørnes
2007-06-10 18:51:33 +00:00
committed by WineHQ
parent d0022decd4
commit f7b24fab9a
14 changed files with 411 additions and 357 deletions

View File

@@ -44,36 +44,36 @@ class Version {
function Version($iVersionId = null, $oRow = null)
{
// we are working on an existing version
if(is_numeric($iVersionId))
{
/*
* We fetch the data related to this version.
*/
if(!$this->iVersionId)
{
if(!$oRow)
{
$sQuery = "SELECT *
FROM appVersion
WHERE versionId = '?'";
if($hResult = query_parameters($sQuery, $iVersionId))
$oRow = mysql_fetch_object($hResult);
}
if(!$iVersionId && !$oRow)
return;
if($oRow)
{
$this->iVersionId = $iVersionId;
$this->iAppId = $oRow->appId;
$this->iSubmitterId = $oRow->submitterId;
$this->sSubmitTime = $oRow->submitTime;
$this->sDate = $oRow->submitTime;
$this->sName = $oRow->versionName;
$this->sDescription = $oRow->description;
$this->sTestedRelease = $oRow->maintainer_release;
$this->sTestedRating = $oRow->maintainer_rating;
$this->sQueued = $oRow->queued;
$this->sLicense = $oRow->license;
}
/*
* We fetch the data related to this version.
*/
if(!$this->iVersionId)
{
if(!$oRow)
{
$sQuery = "SELECT *
FROM appVersion
WHERE versionId = '?'";
if($hResult = query_parameters($sQuery, $iVersionId))
$oRow = mysql_fetch_object($hResult);
}
if($oRow)
{
$this->iVersionId = $oRow->versionId;
$this->iAppId = $oRow->appId;
$this->iSubmitterId = $oRow->submitterId;
$this->sSubmitTime = $oRow->submitTime;
$this->sDate = $oRow->submitTime;
$this->sName = $oRow->versionName;
$this->sDescription = $oRow->description;
$this->sTestedRelease = $oRow->maintainer_release;
$this->sTestedRating = $oRow->maintainer_rating;
$this->sQueued = $oRow->queued;
$this->sLicense = $oRow->license;
}
}
}
@@ -1362,11 +1362,6 @@ class Version {
echo html_tr($aCells, $sClass);
}
function objectGetInstanceFromRow($oRow)
{
return new version($oRow->versionId, $oRow);
}
function objectDisplayQueueProcessingHelp()
{
echo "<p>This is the list of versions waiting for your approval, ".