Skip to content
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

Parameters are not passing to the overwritten include method #128

Open
wahlmika opened this issue Dec 5, 2018 · 3 comments
Open

Parameters are not passing to the overwritten include method #128

wahlmika opened this issue Dec 5, 2018 · 3 comments

Comments

@wahlmika
Copy link

wahlmika commented Dec 5, 2018

Kinda related to #111 because i am dealing with polymorphic relatioships too. I am trying to override include method inside the transformer and query parameters are not passing in to the function.

This is how i call the responder:

return Responder::success($notifications)->respond(200);

Heres how the relationships are declared:

protected $load = [
    'organisation' => OrganisationTransformer::class,
    'user' => UserTransformer::class,
    'relatedUser' => UserTransformer::class,
    'notificationTemplate' => NotificationTemplateTransformer::class,
    'notificationable' // This is the polymoprhic relationship
];

I have overridden the notificationable include same way as in the documentation, but the parameters are not passed to the function.

public function includeNotificationable(Notification $notification, Collection $params) 
{
    dd($params);
}

$params is always an empty collection

Collection {#517 #items: [] }

Am i doing something wrong or is this a bug?

@flugg
Copy link
Owner

flugg commented Jan 30, 2019

Hey @wahlmika, sorry for the late response here - did you find a solution to this?

@wahlmika
Copy link
Author

Thanks for the response @Flugger. Unfortunately i didn't find a solution for this and i had to restructure the code, so that there were no polymorphic relations.

I would still like to know the answer to this if its possible, since there are projects where i'd like to use polymorphic relations.

@flugg
Copy link
Owner

flugg commented Feb 1, 2019

I'll find some time to research and see if I can replicate the issue and find a solution :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants