private function filterValues(array $values)
    {
        foreach ($values as $i => $field) {
            if (is_bool($field)) {
                $values[$i] = (int) $field;
            } elseif ($field instanceof \DateTime) {
                $values[$i] = $field->format('Y-m-d H:i:s');
            } elseif (!is_scalar($field)) {
                unset($values[$i]);
            }
        }
        return $values;
    }
private function filterValues(array $values)
    {
        foreach ($values as $i => $field) {
            if (is_bool($field)) {
                $values[$i] = (int) $field;
            } elseif ($field instanceof \DateTime) {
                $values[$i] = $field->format('Y-m-d H:i:s');
            } elseif (!is_scalar($field)) {
                unset($values[$i]);
            }
        }
        return $values;
    }
private function filterValues ( array $ values ) { foreach ( $ values as $ i => $ field ) { if ( is_bool ( $ field ) ) { $ values [ $ i ] = ( int ) $ field ; } elseif ( $ field instanceof \ DateTime ) { $ values [ $ i ] = $ field -> format ( 'Y-m-d H:i:s' ) ; } elseif ( ! is_scalar ( $ field ) ) { unset ( $ values [ $ i ] ) ; } } return $ values ; }
filterValues removes non-scalar values from the array and formats any DateTime to DB string representation.

@param array $values
@return array
filterValues removes non - scalar values from the array and formats any DateTime to DB string representation .