fico7489 / laravel-eloquent-join

This package introduces the join magic for eloquent models and relations.
MIT License
330 stars 85 forks source link

OrderByJoin for BelongsTo relationships breaks in laravel 5.5 #112

Open ADRDev opened 3 years ago

ADRDev commented 3 years ago

https://github.com/fico7489/laravel-eloquent-join/pull/104

This PR changed how the correct method call is determined by checking if the method name is_callable() or not. However, in our testing with a BelongsTo relationship in Laravel 5.5 is_callable() is returning true no matter what method name you pass and so picks the wrong method to call resulting in an error.

We have rolled back to 4.1.1 in the meantime where the old version check logic is in place.

NesCafe62 commented 3 years ago

I encountered same problem with Eloquent 5.7.17 when updated my fork. Update: I changed is_callable([$relatedRelation, 'getQualifiedForeignKeyName']) to method_exists($relatedRelation, 'getQualifiedForeignKeyName') (same with 'getOwnerKeyName') and it seems to start working