protected function filterValues($table, array $data)
    {
        $scheme = $this->getScheme($table);
        $values = array_intersect_key($data, $scheme['fields']);

        if (empty($values)) {
            return array();
        }

        foreach ($values as $field => &$value) {

            if (!empty($scheme['fields'][$field]['auto_increment'])) {
                unset($values[$field]);
                continue;
            }

            if (is_null($value) && !empty($scheme['fields'][$field]['not_null'])) {
                unset($values[$field]);
                continue;
            }

            if (!empty($scheme['fields'][$field]['serialize'])) {
                if (!is_array($value)) {
                    $value = array();
                }
                $value = serialize($value);
            }
        }

        return $values;
    }
protected function filterValues($table, array $data)
    {
        $scheme = $this->getScheme($table);
        $values = array_intersect_key($data, $scheme['fields']);

        if (empty($values)) {
            return array();
        }

        foreach ($values as $field => &$value) {

            if (!empty($scheme['fields'][$field]['auto_increment'])) {
                unset($values[$field]);
                continue;
            }

            if (is_null($value) && !empty($scheme['fields'][$field]['not_null'])) {
                unset($values[$field]);
                continue;
            }

            if (!empty($scheme['fields'][$field]['serialize'])) {
                if (!is_array($value)) {
                    $value = array();
                }
                $value = serialize($value);
            }
        }

        return $values;
    }
protected function filterValues ( $ table , array $ data ) { $ scheme = $ this -> getScheme ( $ table ) ; $ values = array_intersect_key ( $ data , $ scheme [ 'fields' ] ) ; if ( empty ( $ values ) ) { return array ( ) ; } foreach ( $ values as $ field => & $ value ) { if ( ! empty ( $ scheme [ 'fields' ] [ $ field ] [ 'auto_increment' ] ) ) { unset ( $ values [ $ field ] ) ; continue ; } if ( is_null ( $ value ) && ! empty ( $ scheme [ 'fields' ] [ $ field ] [ 'not_null' ] ) ) { unset ( $ values [ $ field ] ) ; continue ; } if ( ! empty ( $ scheme [ 'fields' ] [ $ field ] [ 'serialize' ] ) ) { if ( ! is_array ( $ value ) ) { $ value = array ( ) ; } $ value = serialize ( $ value ) ; } } return $ values ; }
Filters an array of data according to existing scheme for the given table
@param string $table
@param array $data
@return array
Filters an array of data according to existing scheme for the given table