framework/db/sqlite/Schema.php
protected function findConstraints($table)
    {
        $sql = 'PRAGMA foreign_key_list(' . $this->quoteSimpleTableName($table->name) . ')';
        $keys = $this->db->createCommand($sql)->queryAll();
        foreach ($keys as $key) {
            $id = (int) $key['id'];
            if (!isset($table->foreignKeys[$id])) {
                $table->foreignKeys[$id] = [$key['table'], $key['from'] => $key['to']];
            } else {
                // composite FK
                $table->foreignKeys[$id][$key['from']] = $key['to'];
            }
        }
    }
protected function findConstraints($table)
    {
        $sql = 'PRAGMA foreign_key_list(' . $this->quoteSimpleTableName($table->name) . ')';
        $keys = $this->db->createCommand($sql)->queryAll();
        foreach ($keys as $key) {
            $id = (int) $key['id'];
            if (!isset($table->foreignKeys[$id])) {
                $table->foreignKeys[$id] = [$key['table'], $key['from'] => $key['to']];
            } else {
                // composite FK
                $table->foreignKeys[$id][$key['from']] = $key['to'];
            }
        }
    }
protected function findConstraints ( $ table ) { $ sql = 'PRAGMA foreign_key_list(' . $ this -> quoteSimpleTableName ( $ table -> name ) . ')' ; $ keys = $ this -> db -> createCommand ( $ sql ) -> queryAll ( ) ; foreach ( $ keys as $ key ) { $ id = ( int ) $ key [ 'id' ] ; if ( ! isset ( $ table -> foreignKeys [ $ id ] ) ) { $ table -> foreignKeys [ $ id ] = [ $ key [ 'table' ] , $ key [ 'from' ] => $ key [ 'to' ] ] ; } else { // composite FK $ table -> foreignKeys [ $ id ] [ $ key [ 'from' ] ] = $ key [ 'to' ] ; } } }
Collects the foreign key column details for the given table.
@param TableSchema $table the table metadata
Collects the foreign key column details for the given table .