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

@@ -27,36 +27,36 @@ class testData{
function testData($iTestingId = null, $oRow = null)
{
// we are working on an existing test
if($iTestingId)
{
// We fetch the data related to this test.
if(!$oRow)
{
$sQuery = "SELECT *
FROM testResults
WHERE testingId = '?'";
if($hResult = query_parameters($sQuery, $iTestingId))
$oRow = mysql_fetch_object($hResult);
}
if(!$iTestingId && !$oRow)
return;
if($oRow)
{
$this->iTestingId = $oRow->testingId;
$this->iVersionId = $oRow->versionId;
$this->shWhatWorks = $oRow->whatWorks;
$this->shWhatDoesnt = $oRow->whatDoesnt;
$this->shWhatNotTested = $oRow->whatNotTested;
$this->sTestedDate = $oRow->testedDate;
$this->iDistributionId = $oRow->distributionId;
$this->sTestedRelease = $oRow->testedRelease;
$this->sInstalls = $oRow->installs;
$this->sRuns = $oRow->runs;
$this->sTestedRating = $oRow->testedRating;
$this->sComments = $oRow->comments;
$this->sSubmitTime = $oRow->submitTime;
$this->iSubmitterId = $oRow->submitterId;
$this->sQueued = $oRow->queued;
}
// We fetch the data related to this test.
if(!$oRow)
{
$sQuery = "SELECT *
FROM testResults
WHERE testingId = '?'";
if($hResult = query_parameters($sQuery, $iTestingId))
$oRow = mysql_fetch_object($hResult);
}
if($oRow)
{
$this->iTestingId = $oRow->testingId;
$this->iVersionId = $oRow->versionId;
$this->shWhatWorks = $oRow->whatWorks;
$this->shWhatDoesnt = $oRow->whatDoesnt;
$this->shWhatNotTested = $oRow->whatNotTested;
$this->sTestedDate = $oRow->testedDate;
$this->iDistributionId = $oRow->distributionId;
$this->sTestedRelease = $oRow->testedRelease;
$this->sInstalls = $oRow->installs;
$this->sRuns = $oRow->runs;
$this->sTestedRating = $oRow->testedRating;
$this->sComments = $oRow->comments;
$this->sSubmitTime = $oRow->submitTime;
$this->iSubmitterId = $oRow->submitterId;
$this->sQueued = $oRow->queued;
}
}
@@ -552,7 +552,8 @@ class testData{
if(!$hResult)
return 0;
$oRow = mysql_fetch_object($hResult);
if(!$oRow = mysql_fetch_object($hResult))
return 0;
return $oRow->testingId;
}
@@ -902,11 +903,6 @@ class testData{
return $aCells;
}
function objectGetInstanceFromRow($oRow)
{
return new testData($oRow->testingId, $oRow);
}
function objectOutputTableRow($oObject, $sClass, $sEditLinkLabel)
{
$oVersion = new version($this->iVersionId);