-
-
Notifications
You must be signed in to change notification settings - Fork 436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support SoftDeletes methods on relations #692
Conversation
Hi, Thanks for the failing test case. I tried to explain a little bit what has to be done here: #690 (comment) Let me know if you have any more questions. |
…es trait and the methodName is one of the SoftDeletes methods (withTrashed, withoutTrashed or onlyTrashed)
@canvural I couldn't figure out how to return the proper If you have a good solution on how to resolve the correct |
Hi, Using As I wrote in #690 (comment) we should use the So in Then in $originalMethodReflection = $relatedModelReflection->getMethod($methodName, new OutOfClassScope());
return new EloquentBuilderMethodReflection(
$methodName, $classReflection, $originalMethodReflection,
ParametersAcceptorSelector::selectSingle($originalMethodReflection->getVariants())->getParameters(),
new GenericObjectType($classReflection->getName(), [$relatedModel]),
false
); I can push this fix this if you want 😊 |
We had to pull the logic out of the BuilderHelper and move it back in the RelationForwardsCallsExtension though.
Thanks @canvural. It's working now with the correct |
…xception. We already return it later.
Perfect, thank you! Will merge when the build passes. |
I was waiting for this as v0.6.6 was producing SoftDelete-related errors. |
@szepeviktor I encountered the issue on one of our internal projects, so it was mostly out of a personal need. Happy to have helped others though. |
Issue: #690
Changes
This introduces additional test cases to prove there is a regression issue that was introduced in version 0.6.6.
Methods from the
SoftDeletes
trait are not recognized on Relations even though this is supported throughForwardsCalls
in Laravel.Note that this PR does not yet introduce a fix but aims to clarify the issue defined in #690. I tried coming up with a solution but couldn't find it yet. Any pointers as to how to approach this would be welcome.