Skip to content

Bug: updateBatch() not working anymore in 4.7.0 #9943

Description

@rese-maxime

PHP Version

8.2

CodeIgniter4 Version

4.7.0

CodeIgniter4 Installation Method

Manual (zip or tar.gz)

Which operating systems have you tested for this bug?

Linux

Which server did you use?

apache

Environment

production

Database

SQLServer

What happened?

updateBatch() now consider $index is not changed and throw a exception "the index is missing in the data"

it was working before 4.7.0

Steps to Reproduce

// $returnType = \App\Entities\User::class
$user = $userModel->find($id);
$user->email = 'newemail@domain.com';

$userModel->updateBatch([$user], 'user_id');

Return :
CodeIgniter\Exceptions\InvalidArgumentException: The index ("user_id") for updateBatch() is missing in the data: {"email":"newemail@domain.com"}

Expected Output

The index or at least the primary key must be preserve, because when you update a row, you never change it

Anything else?

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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