Laravel-Backpack / community-forum

A workspace to discuss improvement and feature ideas, before they're actually implemented.
28 stars 0 forks source link

Bug with a hasMany relationship field containing a phone type subfield #874

Closed saucanot closed 4 months ago

saucanot commented 6 months ago

Bug report

What I did

I have a client model. The client can have many contacts. I edit those contacts directly in a new tab with the subfields declared. One of the subfield is of type phone

What I expected to happen

The contact client should be correctly saved together with the client data.

What happened

When inserting only one element, the phone gets a -1 index in the contacts array while all of the other input get a 0 index, with the consequence that the phone is not saved. If I add two elements instead of one, the last one is always excluded for the same reason while the other elements are complete

What I've already tried to fix it

I've modified the phone type in text and everything works correctly

Is it a bug in the latest version of Backpack?

After I run composer update backpack/crud the bug... is it still there?

Yes. I've also tried to update the backpack/pro package

Backpack, Laravel, PHP, DB version

When I run php artisan backpack:version the output is:

PHP VERSION:

PHP 8.1.27 (cli) (built: Jan 11 2024 05:23:09) (NTS) Copyright (c) The PHP Group Zend Engine v4.1.27, Copyright (c) Zend Technologies

LARAVEL VERSION:

10.44.0.0

BACKPACK PACKAGE VERSIONS:

backpack/basset: 1.2.2 backpack/crud: 6.6.6 backpack/devtools: 3.0.4 backpack/generators: v4.0.3 backpack/permissionmanager: 7.1.1 backpack/pro: 2.1.9 backpack/theme-tabler: 1.2.0

karandatwani92 commented 6 months ago

Hey @saucanot

I tested it to confirm the BUG. Sorry for the inconvenience. I've assigned my colleague @pxpm to fix it.

Thanks for reporting

pxpm commented 4 months ago

Hey @saucanot and @karandatwani92

Thanks for reporting and confirming the issue. 🙏

I've just released a fix in backpack/pro: 2.2.3 . Please allow a few moments for our private repository to pick the updated version and you should be able to get the fix with a composer update.

Please re-open or comment if you still experience issues after the update.

Cheers