Skip to content

Bug: Casting happens in insert but not in insertBatch #9695

@patel-vansh

Description

@patel-vansh

PHP Version

8.4

CodeIgniter4 Version

4.6.3

CodeIgniter4 Installation Method

Composer (using codeigniter4/appstarter)

Which operating systems have you tested for this bug?

macOS

Which server did you use?

apache

Database

MariaDB 10.4.28

What happened?

When using Model->insert() command, casting (eg. converting of array type to json encoded array) happens. But when using Model->insertBatch() command, casting of each row doesn't happen.

Steps to Reproduce

Create a table with atleast one column that stores json encoded values (i.e, of type TEXT, MEDIUMTEXT, LONGTEXT, etc.). Inside model, set the $cast of that column to type array. Then, fire up Model->insertBatch() command and for each row, pass an array (not string) for that model. The insert command will not insert values to DB.

Expected Output

The insertBatch should perform the casting on each row similar to that done in insert command.

Anything else?

I think I can contribute this but I don't know where to start. I mean, are there any specific things I need to setup before/after making changes or other things like that or just sending PR containing signed commits would suffice?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugVerified issues on the current code behavior or pull requests that will fix them

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions