Menu

[r112]: / trunk / PhpCheckstyle / test / unusedcode.php  Maximize  Restore  History

Download this file

66 lines (51 with data), 2.0 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
/**
* Fill a line of data with the values a table, given its primary key.
* Only one object is expected in return.
*
* @param DataObject $data the shell of the data object with the values for the primary key.
* @return DataObject The complete data object.
*/
public function getDatum($data) {
$db = $this->getAdapter();
$tableFormat = $data->tableFormat;
$this->logger->info('getDatum : '.$tableFormat->format);
// Get the values from the data table
$sql = "SELECT ".$this->genericService->buildSelect($data->getFields());
$sql .= " FROM ".$tableFormat->schemaCode.".".$tableFormat->tableName." AS ".$tableFormat->format;
$sql .= " WHERE(1 = 1) ".$this->genericService->buildWhere($data->infoFields);
$this->logger->info('getDatum : '.$sql);
$select = $db->prepare($sql);
$select->execute();
$row = $select->fetch();
// Fill the values with data from the table
foreach ($data->editableFields as $field) {
$key = strtolower($field->getName());
$field->value = $row[$key];
// Store additional info for geometry type
if ($field->unit == "GEOM") {
$field->xmin = $row[strtolower($key).'_x_min'];
$field->xmax = $row[strtolower($key).'_x_max'];
$field->ymin = $row[strtolower($key).'_y_min'];
$field->ymax = $row[strtolower($key).'_y_max'];
} else if ($field->type == "ARRAY") {
// For array field we transform the value in a array object
$field->value = $this->genericService->stringToArray($field->value);
}
}
// Fill the values with data from the table
foreach ($data->getFields() as $field) {
// Fill the value labels for the field
$field = $this->genericService->fillValueLabel($field);
}
return $data;
}
/**
* Get a line of data from a table, given its primary key.
* A list of objects is expected in return.
*
* @param DataObject $data the shell of the data object with the values for the primary key.
* @return Array[DataObject] The complete data objects.
*/
public function getData($data) {
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.