protected function _getRecords(array $records, TableSchema $schema)
    {
        $fields = $values = $types = [];
        $columns = $schema->columns();
        foreach ($records as $record) {
            $fields = array_merge($fields, array_intersect(array_keys($record), $columns));
        }
        $fields = array_values(array_unique($fields));
        foreach ($fields as $field) {
            $types[$field] = $schema->column($field)['type'];
        }
        $default = array_fill_keys($fields, null);
        foreach ($records as $record) {
            $values[] = array_merge($default, $record);
        }

        return [$fields, $values, $types];
    }
protected function _getRecords(array $records, TableSchema $schema)
    {
        $fields = $values = $types = [];
        $columns = $schema->columns();
        foreach ($records as $record) {
            $fields = array_merge($fields, array_intersect(array_keys($record), $columns));
        }
        $fields = array_values(array_unique($fields));
        foreach ($fields as $field) {
            $types[$field] = $schema->column($field)['type'];
        }
        $default = array_fill_keys($fields, null);
        foreach ($records as $record) {
            $values[] = array_merge($default, $record);
        }

        return [$fields, $values, $types];
    }
protected function _getRecords ( array $ records , TableSchema $ schema ) { $ fields = $ values = $ types = [ ] ; $ columns = $ schema -> columns ( ) ; foreach ( $ records as $ record ) { $ fields = array_merge ( $ fields , array_intersect ( array_keys ( $ record ) , $ columns ) ) ; } $ fields = array_values ( array_unique ( $ fields ) ) ; foreach ( $ fields as $ field ) { $ types [ $ field ] = $ schema -> column ( $ field ) [ 'type' ] ; } $ default = array_fill_keys ( $ fields , null ) ; foreach ( $ records as $ record ) { $ values [ ] = array_merge ( $ default , $ record ) ; } return [ $ fields , $ values , $ types ] ; }
Converts the given array of records into data used to generate a query.

@param array $records Records to be imported
@param \Cake\Database\Schema\Table $schema Table schema for which records will
be imported
@return array
Converts the given array of records into data used to generate a query .