/** * Obtain DBMS specific SQL code portion needed to set an index * declaration to be used in statements like CREATE TABLE. * * @return string * @override */ public function getIndexFieldDeclarationListSql(array $fields) { $declFields = array(); foreach ($fields as $fieldName => $field) { $fieldString = '`' . $fieldName . '`'; if (is_array($field)) { if (isset($field['length'])) { $fieldString .= '(' . $field['length'] . ')'; } if (isset($field['sorting'])) { $sort = strtoupper($field['sorting']); switch ($sort) { case 'ASC': case 'DESC': $fieldString .= ' ' . $sort; break; default: throw DoctrineException::unknownIndexSortingOption($sort); } } } else { $fieldString = '`' . $field . '`'; } $declFields[] = $fieldString; } return implode(', ', $declFields); }