Relationship accross multiple form components
martin-ro opened this issue · comments
Package
filament/filament
Package Version
v3.2.90
Laravel Version
v11.10.0
Livewire Version
v3.5.0
PHP Version
PHP 8.3.8
Problem description
Relationship data is not saved as expected when using multiple form components with the same relationship.
Example:
Forms\Components\Section::make()
->relationship('sale')
->statePath('firstSection')
->schema([
// ...
]),
Forms\Components\TextInput::make('name'),
Forms\Components\Section::make()
->relationship('sale')
->statePath('secondSection')
->schema([
// Fields in this section are completely ignored
]),
I have also tried to use the same name for statePath
.
The same issue was previously discussed here: #10536
The approach of giving the different section both relationship
and statePath
doesn't seem to work (#10536 (comment)).
Expected behavior
According to #10536 (comment) the example above should work.
Steps to reproduce
See example above or linked repo.
Reproduction repository (issue will be closed if this is not valid)
https://github.com/martin-ro/filament-relationship-multiple-components
Relevant log output
SQLSTATE[23000]: Integrity constraint violation: 19 NOT NULL constraint failed: sales.price (Connection: sqlite, SQL: insert into "sales" ("name", "updated_at", "created_at") values (voluptas, 2024-06-18 06:25:00, 2024-06-18 06:25:00))
Donate 💰 to fund this issue
- You can donate funding to this issue. We receive the money once the issue is completed & confirmed by you.
- 100% of the funding will be distributed between the Filament core team to run all aspects of the project.
- Thank you in advance for helping us make maintenance sustainable!