I need to pass a null value for a database column, according to the code below:
$birthdate = null;
User::update()
->set('name', $name)
->set('email', $email)
->set('birthdate', $birthdate)
->where('id', $id)
->execute();
But the error is generated:
How to do this ?
Note: The update is a method of clancats hydrahon.
I believe that the problem occurs in that part of the library code.
public function set($param1, $param2 = null)
{
// do nothing if we get nothing
if (empty($param1))
{
return $this;
}
// when param 2 is not null we assume that only one set is passed
// like: set( 'name', 'Lu' ); instead of set( array( 'name' => 'Lu' ) );
if ( !is_null( $param2 ) )
{
$param1 = array( $param1 => $param2 );
}
// merge the new values with the existing ones.
$this->values = array_merge( $this->values, $param1 );
// return self so we can continue running the next function
return $this;
}