lib/gii/cascadeTypeModule/Generator.php
public function generateTableIndices($table)
    {
        $tableName = $table->name;
        $meta = $this->findTableKeys($table);
        $niceName = lcfirst(Inflector::id2camel($tableName, '_'));

        if ($this->getPrimaryKeyLocation($table) === 'index') {
            foreach ($meta['primaryKeys'] as $name => $parts) {
                $keys = $parts['keys'];
                $unique = !empty($parts['unique']);
                $i[] = "\$this->addPrimaryKey('{$niceName}Pk', '{$tableName}', '" . implode(',', $keys) . "');";
            }
        }

        foreach ($meta['indices'] as $name => $parts) {
            $keys = $parts['keys'];
            $name = $this->fixIndexName($name, $table, $keys);
            $unique = !empty($parts['unique']);
            $i[] = "\$this->createIndex('{$name}', '{$tableName}', '" . implode(',', $keys) . "', " . ($unique ? 'true' : 'false') . ");";
        }

        foreach ($meta['foreignKeys'] as $fk) {
            $keys = $fk['keys'];
            $unique = !empty($fk['unique']);
            $name = $this->fixIndexName($fk['name'], $table, array_values($keys));
            $i[] = "\$this->addForeignKey('{$fk['name']}', '{$tableName}', '" . implode(',', array_keys($fk['keys'])) . "', '{$fk['table']}', '" . implode(',', array_values($fk['keys'])) . "', '{$fk['onDelete']}', '{$fk['onUpdate']}');";
        }

        return implode("\n\t\t", $i);
    }
public function generateTableIndices($table)
    {
        $tableName = $table->name;
        $meta = $this->findTableKeys($table);
        $niceName = lcfirst(Inflector::id2camel($tableName, '_'));

        if ($this->getPrimaryKeyLocation($table) === 'index') {
            foreach ($meta['primaryKeys'] as $name => $parts) {
                $keys = $parts['keys'];
                $unique = !empty($parts['unique']);
                $i[] = "\$this->addPrimaryKey('{$niceName}Pk', '{$tableName}', '" . implode(',', $keys) . "');";
            }
        }

        foreach ($meta['indices'] as $name => $parts) {
            $keys = $parts['keys'];
            $name = $this->fixIndexName($name, $table, $keys);
            $unique = !empty($parts['unique']);
            $i[] = "\$this->createIndex('{$name}', '{$tableName}', '" . implode(',', $keys) . "', " . ($unique ? 'true' : 'false') . ");";
        }

        foreach ($meta['foreignKeys'] as $fk) {
            $keys = $fk['keys'];
            $unique = !empty($fk['unique']);
            $name = $this->fixIndexName($fk['name'], $table, array_values($keys));
            $i[] = "\$this->addForeignKey('{$fk['name']}', '{$tableName}', '" . implode(',', array_keys($fk['keys'])) . "', '{$fk['table']}', '" . implode(',', array_values($fk['keys'])) . "', '{$fk['onDelete']}', '{$fk['onUpdate']}');";
        }

        return implode("\n\t\t", $i);
    }
public function generateTableIndices ( $ table ) { $ tableName = $ table -> name ; $ meta = $ this -> findTableKeys ( $ table ) ; $ niceName = lcfirst ( Inflector :: id2camel ( $ tableName , '_' ) ) ; if ( $ this -> getPrimaryKeyLocation ( $ table ) === 'index' ) { foreach ( $ meta [ 'primaryKeys' ] as $ name => $ parts ) { $ keys = $ parts [ 'keys' ] ; $ unique = ! empty ( $ parts [ 'unique' ] ) ; $ i [ ] = "\$this->addPrimaryKey('{$niceName}Pk', '{$tableName}', '" . implode ( ',' , $ keys ) . "');" ; } } foreach ( $ meta [ 'indices' ] as $ name => $ parts ) { $ keys = $ parts [ 'keys' ] ; $ name = $ this -> fixIndexName ( $ name , $ table , $ keys ) ; $ unique = ! empty ( $ parts [ 'unique' ] ) ; $ i [ ] = "\$this->createIndex('{$name}', '{$tableName}', '" . implode ( ',' , $ keys ) . "', " . ( $ unique ? 'true' : 'false' ) . ");" ; } foreach ( $ meta [ 'foreignKeys' ] as $ fk ) { $ keys = $ fk [ 'keys' ] ; $ unique = ! empty ( $ fk [ 'unique' ] ) ; $ name = $ this -> fixIndexName ( $ fk [ 'name' ] , $ table , array_values ( $ keys ) ) ; $ i [ ] = "\$this->addForeignKey('{$fk['name']}', '{$tableName}', '" . implode ( ',' , array_keys ( $ fk [ 'keys' ] ) ) . "', '{$fk['table']}', '" . implode ( ',' , array_values ( $ fk [ 'keys' ] ) ) . "', '{$fk['onDelete']}', '{$fk['onUpdate']}');" ; } return implode ( "\n\t\t" , $ i ) ; }
[[@doctodo method_description:generateTableIndices]].

@param [[@doctodo param_type:table]] $table [[@doctodo param_description:table]]

@return [[@doctodo return_type:generateTableIndices]] [[@doctodo return_description:generateTableIndices]]
[[ @doctodo method_description : generateTableIndices ]] .