Skip to content

Bug: Entity Bulk Accessing property not working properly  #9200

@austin92jus

Description

@austin92jus

PHP Version

8.2

CodeIgniter4 Version

4.5

CodeIgniter4 Installation Method

Composer (using codeigniter4/appstarter)

Which operating systems have you tested for this bug?

Linux

Which server did you use?

apache

Database

mysql

What happened?

while i was upgrade from 4.3 to 4.5 I face the issues on Bulk access entity
early same code working fine
but now its not working properly

class Staff extends Entity {
protected $attributes =['name' => null, 'email' => null];
}

Model Class

class StaffModel extends Model {
	protected $table = 'staff_address';
	protected $primaryKey = 'id';
	protected $returnType = \App\Domain\Staff\Staff::class;
	protected $useSoftDeletes = false;
	protected $allowedFields = ['name', 'email',
	];
	protected $useTimestamps = true;
}

controller

function save(){
$req = [
['name' => 'test','email' => '[testmail.com](http://testmail.com/)'],
['name' => 'testsd','email' => '[testmail1.com](http://testmail1.com/)']
]
$entiy = new Staff($req);
// throw error
code
:
500
file
:
"/var/www/gemsAdmin/gems-backend/vendor/codeigniter4/framework/system/Entity/Entity.php"
line
:
411
message
:
"CodeIgniter\\Entity\\Entity::__set(): Argument #1 ($key) must be of type string, int given, called in /var/www/gemsAdmin/gems-backend/vendor/codeigniter4/framework/system/Entity/Entity.php on line 162"
title
:
"TypeError"
trace
:
[{file: "/var/www/gemsAdmin/gems-backend/vendor/codeigniter4/framework/system/Entity/Entity.php",…},…]
type
:
"TypeError"

Steps to Reproduce

Try to pass array of array data to any entity

Expected Output

out put comes array of array while I call toRawArray() method in entity

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions