Supported Versions: PHP 4 >= 4.0.1, PHP 5, PHP 7, PHP 8
Removes duplicate values from an array
<?php array_unique(array $array, int $flags = SORT_STRING): array
<?php }
if (isset($options['primary']) && ! empty($options['primary'])) {
$columnListSql .= ', PRIMARY KEY(' . implode(', ', array_unique(array_values($options['primary']))) . ')';
}
if (isset($options['indexes']) && ! empty($options['indexes'])) {
<?php if (isset($options['primary']) && ! empty($options['primary'])) {
$keyColumns = array_unique(array_values($options['primary']));
$queryFields .= ', PRIMARY KEY(' . implode(', ', $keyColumns) . ')';
}
<?php }
if (isset($diff->addedIndexes['primary'])) {
$keyColumns = array_unique(array_values($diff->addedIndexes['primary']->getColumns()));
$queryParts[] = 'ADD PRIMARY KEY (' . implode(', ', $keyColumns) . ')';
unset($diff->addedIndexes['primary']);
} elseif (isset($diff->changedIndexes['primary'])) {
<?php foreach ($diff->changedIndexes['primary']->getColumns() as $columnName) {
if (isset($diff->addedColumns[$columnName]) && $diff->addedColumns[$columnName]->getAutoincrement()) {
$keyColumns = array_unique(array_values($diff->changedIndexes['primary']->getColumns()));
$queryParts[] = 'DROP PRIMARY KEY';
$queryParts[] = 'ADD PRIMARY KEY (' . implode(', ', $keyColumns) . ')';
unset($diff->changedIndexes['primary']);
<?php $queryFields = $this->getColumnDeclarationListSQL($columns);
if (isset($options['primary']) && ! empty($options['primary'])) {
$keyColumns = array_unique(array_values($options['primary']));
$queryFields .= ', PRIMARY KEY(' . implode(', ', $keyColumns) . ')';
}
<?php return '';
}
$keyColumns = array_unique(array_values($options['primary']));
foreach ($keyColumns as $keyColumn) {
if (! empty($columns[$keyColumn]['autoincrement'])) {
<?php }
$columnListSql .= ', PRIMARY KEY' . $flags
. ' (' . implode(', ', array_unique(array_values($options['primary']))) . ')';
}
$query = 'CREATE TABLE ' . $name . ' (' . $columnListSql;
<?php $changedProperties[] = $key;
}
return array_unique($changedProperties);
}