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

@@ -17,25 +17,30 @@ class downloadurl
var $bQueued;
/* Fetch the data if id is given */
function downloadurl($iId = NULL)
function downloadurl($iId = NULL, $oRow = NULL)
{
$hResult = query_parameters("SELECT id, versionId, description, url,
submitTime, submitterId, queued FROM appData WHERE id = '?'",
$iId);
if(!$iId && !$oRow)
return;
if($hResult && mysql_num_rows($hResult))
if(!$oRow)
{
$oRow = mysql_fetch_object($hResult);
if($oRow)
{
$this->iId = $oRow->id;
$this->iVersionId = $oRow->versionId;
$this->sDescription = $oRow->description;
$this->sUrl = $oRow->url;
$this->sSubmitTime = $oRow->submitTime;
$this->iSubmitterId = $oRow->submitterId;
$this->bQueued = ($oRow->queued == "true") ? TRUE : FALSE;
}
$hResult = query_parameters("SELECT id, versionId, description, url,
submitTime, submitterId, queued FROM appData WHERE id = '?'",
$iId);
if($hResult && mysql_num_rows($hResult))
$oRow = mysql_fetch_object($hResult);
}
if($oRow)
{
$this->iId = $oRow->id;
$this->iVersionId = $oRow->versionId;
$this->sDescription = $oRow->description;
$this->sUrl = $oRow->url;
$this->sSubmitTime = $oRow->submitTime;
$this->iSubmitterId = $oRow->submitterId;
$this->bQueued = ($oRow->queued == "true") ? TRUE : FALSE;
}
}
@@ -407,11 +412,6 @@ class downloadurl
$oAppData->objectOutputTableRow($oObject, $sClass, $sEditLinkLabel);
}
function objectGetInstanceFromRow($oRow)
{
return new appData($oRow->id, $oRow);
}
function getOutputEditorValues($aClean)
{
$this->sUrl = $aClean['sDownloadUrlUrl'];