Wrong foregin key in AssociateAction
I have a RelationManager with an
AssociateAction
, but it doesn't work because it tries to change the wrong foregin key on the related model. THe relationship works as it should and items are listed in the RelationManager. The problem is that the AssociateAction
uses a pluralised foregin key when it should be use a singular, for example posts_id
instead of post_id
. I have even tried specifing the foregin key in the relation on the model, but that did not help. I have verified that there is nothing wrong with the relation setup between the models and the convention is FK with singular name.3 Replies
Possibly related to: AssociateAction derives wrong inverse relationship name #14090
GitHub
AssociateAction derives wrong inverse relationship name · Issue #14...
Inverse relationship is derived as plural of the model name while it should be singular. Donate 💰 to fund this issue You can donate funding to this issue. We receive the money once the issue is com...
Yes, exactly. Thank you!
I thought I was doing something wrong, but it seems to be a bug then
Submitted a PR to fix this now: https://github.com/filamentphp/filament/pull/14145
GitHub
Change plural to singular in getInverseRelationship in HasQuery by ...
Description
This fixes #14090 where the inverse of a one to many-relationship in the AssociateAction uses plural for the relation name and subsequently also the foreign key. This is according to th...