Add and use objectGetChildren() method. Add support for initializing comment class from SQL

result.
This commit is contained in:
Alexander Nicolaysen Sørnes
2007-09-08 22:38:20 +00:00
committed by WineHQ
parent faf7d9bb19
commit 5a4cbf49a3
4 changed files with 252 additions and 191 deletions

View File

@@ -27,9 +27,12 @@ class Comment {
* Constructor.
* If $iCommentId is provided, fetches comment.
*/
function Comment($iCommentId="")
function Comment($iCommentId = null, $oRow = null)
{
if(is_numeric($iCommentId))
if(!$iCommentId && !$oRow)
return;
if(!$oRow)
{
$sQuery = "SELECT appComments.*, appVersion.appId AS appId
FROM appComments, appVersion
@@ -37,6 +40,10 @@ class Comment {
AND commentId = '?'";
$hResult = query_parameters($sQuery, $iCommentId);
$oRow = query_fetch_object($hResult);
}
if($oRow)
{
$this->iCommentId = $oRow->commentId;
$this->iParentId = $oRow->parentId;
$this->iAppId = $oRow->appId;