/** * Build the project object array from the given result set * * @param resource $result Result set from the database * @return array Array of Project objects */ public static function projectObjArr($result) { $objArr = null; while ($row = mysql_fetch_assoc($result)) { $tmpcusArr = new Projects(); $tmpcusArr->setProjectId($row[self::PROJECT_DB_FIELD_PROJECT_ID]); $tmpcusArr->setCustomerId($row[self::PROJECT_DB_FIELD_CUSTOMER_ID]); $tmpcusArr->setProjectName($row[self::PROJECT_DB_FIELD_NAME]); $tmpcusArr->setProjectDescription($row[self::PROJECT_DB_FIELD_DESCRIPTION]); $tmpcusArr->setDeleted($row[self::PROJECT_DB_FIELD_DELETED]); $objArr[] = $tmpcusArr; } return $objArr; }
public function fetchCustomersProjects($customerId = 0) { $projectObj = new Projects(); if ($customerId != 0) { $projectObj->setCustomerId($customerId); } $projectObj->setDeleted(Projects::PROJECT_NOT_DELETED); $projects = $projectObj->fetchProjects(); $projectArr = null; if (isset($projects)) { foreach ($projects as $project) { $tmpArr[0] = $project->getProjectId(); $tmpArr[1] = $project->getProjectName(); $projectArr[] = $tmpArr; } } return $projectArr; }