original_string: 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];
      }
code: 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];
      }
code_tokens: 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 ] ; }
docstring: 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
docstring_tokens: Converts the given array of records into data used to generate a query .