public static convertOrderField ( string $table, string $field ) | ||
$table | string | The table name |
$field | string | The field name |
public static function convertOrderField($table, $field)
{
$objDatabase = \Database::getInstance();
// Get the non-empty rows
$objRow = $objDatabase->query("SELECT id, {$field} FROM {$table} WHERE {$field} LIKE '%,%'");
// Convert the comma separated lists into serialized arrays
while ($objRow->next()) {
$objDatabase->prepare("UPDATE {$table} SET {$field}=? WHERE id=?")->execute(serialize(explode(',', $objRow->{$field})), $objRow->id);
}
static::convertMultiField($table, $field);
}