diff --git a/php/EE/Model/Base.php b/php/EE/Model/Base.php index 2d8ee3baf..cb187beed 100644 --- a/php/EE/Model/Base.php +++ b/php/EE/Model/Base.php @@ -166,13 +166,18 @@ public static function create( $columns = [] ) { * Returns all model with condition * * @param string|array $column Column to search in - * @param string $value Value to match + * @param string $value Value to match * * @throws \Exception * * @return array */ public static function where( $column, $value = '' ) { + + if ( is_bool( $value ) ) { + $value = (int) $value; + } + return static::many_array_to_model( EE::db() ->table( static::$table ) @@ -245,8 +250,15 @@ public function __unset( $name ) { * @return bool Model saved successfully */ public function save() { + $fields = $this->fields; + foreach ( $fields as $key => $value ) { + if ( is_bool( $value ) ) { + $fields[ $key ] = (int) $value; + } + } + if ( static::$needs_update_timestamp ) { $fields = array_merge( $fields, [