Contao\CoreBundle\Doctrine\Schema\DcaSchemaProvider::parseIndexSql PHP Метод

parseIndexSql() приватный Метод

Parses the index definition and adds it to the schema table.
private parseIndexSql ( Doctrine\DBAL\Schema\Table $table, string $keyName, string $sql )
$table Doctrine\DBAL\Schema\Table
$keyName string
$sql string
    private function parseIndexSql(Table $table, $keyName, $sql)
    {
        if ('PRIMARY' === $keyName) {
            if (!preg_match_all('/`([^`]+)`/', $sql, $matches)) {
                throw new \RuntimeException(sprintf('Primary key definition "%s" could not be parsed.', $sql));
            }
            $table->setPrimaryKey($matches[1]);
            return;
        }
        if (!preg_match('/(.*) `([^`]+)` \\((.*)\\)/', $sql, $matches)) {
            throw new \RuntimeException(sprintf('Key definition "%s" could not be parsed.', $sql));
        }
        $columns = [];
        $flags = [];
        foreach (explode(',', $matches[3]) as $column) {
            preg_match('/`([^`]+)`(\\((\\d+)\\))?/', $column, $cm);
            $column = $cm[1];
            if (isset($cm[3])) {
                $column .= '(' . $cm[3] . ')';
            }
            $columns[$cm[1]] = $column;
        }
        if (false !== strpos($matches[1], 'unique')) {
            $table->addUniqueIndex($columns, $matches[2]);
        } else {
            if (false !== strpos($matches[1], 'fulltext')) {
                $flags[] = 'fulltext';
            }
            $table->addIndex($columns, $matches[2], $flags);
        }
    }