Open
Description
PHP Version
8.1
CodeIgniter4 Version
4.3.4
CodeIgniter4 Installation Method
Composer (as dependency to an existing project)
Which operating systems have you tested for this bug?
macOS
Which server did you use?
apache
Database
PostgreSQL 15.2
What happened?
When try to cast boolean value in entity when use PostgreSQL the value is always true
When check the entity the value true
is set as string t
, and the value false
is set as string f
The BooleanCast
cast as (bool) $value
so the value always returns true
Steps to Reproduce
class TestEntity extends BaseEntity
{
protected $casts = [
'bolean_value' => 'boolean',
];
protected $datamap = [
'boleanValue' => 'bolean_value',
];
}
class TestModel extends APIBaseModel
{
protected $table = 'postgresql_table';
protected $returnType = TestEntity::class;
}
class TestController extends BaseController
{
protected $modelName = TestModel::class;
public function find(): Response
{
return $this->respond($this->model->first());
}
}
Expected Output
{
"boleanValue": false
}
When postgresql DB entry is false
but always returns true
Anything else?
No response