public static function getDatasetsArray($rows) { $datasets = array(); if (!empty($rows)) { // Convert the array of arrays into an array of Datasets // and set the id and date_created fields foreach ($rows as $datasetRow) { $dataset = new Dataset($datasetRow); $datasetId = $datasetRow['dataset_id']; $dataset->setDatasetId($datasetId); $datasetDateCreated = $datasetRow['date_created']; $dataset->setDateCreated($datasetDateCreated); // TODO: We should also get the dataset's associated sensors // Coordinate this in the controller array_push($datasets, $dataset); } } return $datasets; }