本文整理匯總了PHP中Dataset::setDatasetId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Dataset::setDatasetId方法的具體用法?PHP Dataset::setDatasetId怎麽用?PHP Dataset::setDatasetId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Dataset
的用法示例。
在下文中一共展示了Dataset::setDatasetId方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getDatasetsArray
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;
}
示例2: updateDataset
private function updateDataset()
{
$dataset = $_SESSION['dataset'];
if (empty($dataset)) {
HomeView::show();
header('Location: /' . $_SESSION['base']);
} elseif ($_SERVER['REQUEST_METHOD'] == 'GET') {
DatasetView::showUpdate();
} else {
$params = $dataset->getParameters();
$params['dataset_name'] = array_key_exists('dataset_name', $_POST) ? $_POST['dataset_name'] : '';
$params['description'] = array_key_exists('description', $_POST) ? $_POST['description'] : '';
$updatedDataset = new Dataset($params);
$updatedDataset->setDatasetId($dataset->getDatasetId());
$returnedDataset = DatasetsDB::updateDataset($updatedDataset);
if ($returnedDataset->getErrorCount() == 0) {
// Show the Dataset view which should display the updated params
DatasetView::show();
header('Location: /' . $_SESSION['base'] . '/dataset/show/' . $dataset->getDatasetId());
} else {
// Carry over the sensors, if any
$updatedDataset->setSensors($dataset->getSensors());
$_SESSION['dataset'] = $updatedDataset;
DatasetView::showUpdate();
}
}
}
示例3: testUpdateDatasetDescription
public function testUpdateDatasetDescription()
{
$myDb = DBMaker::create('sensordatarepotest');
Database::clearDB();
$db = Database::getDB('sensordatarepotest', 'C:\\xampp\\myConfig.ini');
$testDatasetId = 1;
$datasets = DatasetsDB::getDatasetsBy('dataset_id', $testDatasetId);
$dataset = $datasets[0];
$this->assertTrue(empty($dataset->getDescription()), 'Before the update, it should have an empty description');
$params = $dataset->getParameters();
$params['description'] = 'Updated description';
$newDataset = new Dataset($params);
$newDataset->setDatasetId($testDatasetId);
$returnedDataset = DatasetsDB::updateDataset($newDataset);
$this->assertEquals($returnedDataset->getDescription(), $params['description'], 'After the update it should have the name ' . $params['description']);
}