Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/storage/lisk/LiskDAO.php
Show First 20 Lines • Show All 1,744 Lines • ▼ Show 20 Lines | $builtin = array( | ||||
'epoch' => 'epoch', | 'epoch' => 'epoch', | ||||
'dateCreated' => 'epoch', | 'dateCreated' => 'epoch', | ||||
'dateModified' => 'epoch', | 'dateModified' => 'epoch', | ||||
); | ); | ||||
$map = array(); | $map = array(); | ||||
foreach ($this->getAllLiskProperties() as $property) { | foreach ($this->getAllLiskProperties() as $property) { | ||||
// First, use types specified explicitly in the table configuration. | // First, use types specified explicitly in the table configuration. | ||||
$type = idx($custom_map, $property); | if (array_key_exists($property, $custom_map)) { | ||||
if ($type) { | $map[$property] = $custom_map[$property]; | ||||
$map[$property] = $type; | |||||
continue; | continue; | ||||
} | } | ||||
// If we don't have an explicit type, try a builtin type for the | // If we don't have an explicit type, try a builtin type for the | ||||
// column. | // column. | ||||
$type = idx($builtin, $property); | $type = idx($builtin, $property); | ||||
if ($type) { | if ($type) { | ||||
$map[$property] = $type; | $map[$property] = $type; | ||||
Show All 17 Lines | foreach ($this->getAllLiskProperties() as $property) { | ||||
// If the column is named `somethingID`, infer it is an ID. | // If the column is named `somethingID`, infer it is an ID. | ||||
if (preg_match('/[a-z]ID$/', $property)) { | if (preg_match('/[a-z]ID$/', $property)) { | ||||
$map[$property] = 'id'; | $map[$property] = 'id'; | ||||
continue; | continue; | ||||
} | } | ||||
// We don't know the type of this column. | // We don't know the type of this column. | ||||
$map[$property] = null; | $map[$property] = '<unknown>'; | ||||
} | } | ||||
return $map; | return $map; | ||||
} | } | ||||
public function getSchemaKeys() { | public function getSchemaKeys() { | ||||
$custom_map = $this->getConfigOption(self::CONFIG_KEY_SCHEMA); | $custom_map = $this->getConfigOption(self::CONFIG_KEY_SCHEMA); | ||||
if (!$custom_map) { | if (!$custom_map) { | ||||
Show All 23 Lines |