protected function DrupalVersion5::getFieldTypeColumns in Drupal-to-Drupal data migration 7.2
Detect what database columns are available for the given field.
Parameters
$field_info: Info describing the incoming field. We specifically are looking at the field_name, type_name, and db_storage values.
Return value
array List of column suffixes relevant to the field ('value', 'fid', etc.).
1 call to DrupalVersion5::getFieldTypeColumns()
- DrupalVersion5::populateSourceFieldInfo in d5/
d5.inc - Retrieve info on all fields attached to the given entity type and bundle. Populates $this->sourceFieldInfo.
File
- d5/
d5.inc, line 149 - Implementation of DrupalVersion for Drupal 5 sources.
Class
- DrupalVersion5
- Drupal 5 implementations of functions shared among multiple types of objects.
Code
protected function getFieldTypeColumns($field_info) {
$field_name = $field_info->field_name;
if ($field_info->db_storage) {
$table_name = 'content_type_' . $field_info->type_name;
}
else {
$table_name = 'content_' . $field_name;
}
$row = Database::getConnection('default', $this->arguments['source_connection'])
->select($table_name, 't')
->fields('t')
->range(0, 1)
->execute()
->fetchObject();
$type_columns = array();
if ($row) {
foreach ($row as $column_name => $column_value) {
if (!strncmp($field_name, $column_name, strlen($field_name))) {
$type_columns[] = substr($column_name, strlen($field_name) + 1);
}
}
}
return $type_columns;
}