core icon indicating copy to clipboard operation
core copied to clipboard

fix(laravel): belongs-to-many relations dont have a get-foreign-key-name method

Open mariantrifu opened this issue 1 month ago • 2 comments

Q A
Branch? 4.2
Tickets Closes #7587 https://github.com/api-platform/core/issues/7587
License MIT

API Platform library tries to extract the foreign_key from all relations, but BelongsToMany relations don't have a getForeignKeyName() method, so it returns null. When API Platform tries to flip an array containing null values, PHP throws the error: array_flip(): Can only flip string and integer values, entry skipped.

mariantrifu avatar Dec 05 '25 22:12 mariantrifu

Hi , i have same problem , when do you think you can merge ? this fix ?

@soyuka

MakFly avatar Dec 08 '25 11:12 MakFly

sure thing is I need to add a test you can also just drop an example of model and request I'll add it (though any llm can do it inside the workbench and the functional tests)

soyuka avatar Dec 08 '25 16:12 soyuka