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

feat: generic relations #518

Merged
merged 1 commit into from
Apr 2, 2020
Merged

feat: generic relations #518

merged 1 commit into from
Apr 2, 2020

Conversation

canvural
Copy link
Collaborator

@canvural canvural commented Apr 2, 2020

This PR mainly does 2 things:

  • Before, to get the related model of a relation we were executing the users' code and then getting the related model with getRelatedModel method. While analyzing some public Laravel apps with Larastan I saw this caused some issues. So this PR changes the behavior and tries to find the related model statically.
  • Relations are now also generic. This allows us to drop some extensions, and use stubs to provide the same functionality. Also, it'll make easier to fix any problem that can come up. We just need to edit the stubs.

The existing code is not affected by any changes. So this is not a breaking change.

Copy link
Collaborator

@nunomaduro nunomaduro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@canvural Would be cool if we could find another contributor that is using Larastan that can actually validate this pull requests. I don't work within this codebase for a while. So it's difficult for me to actually check if everything sounds good.

What do you think? Do you know someone? We can always ask on twitter.

@canvural
Copy link
Collaborator Author

canvural commented Apr 2, 2020

That's a good idea! Sometimes I not sure if a particular thing that I'm doing is the right way or there is an easier way.

Unfortunately I don't know anyone. We had some contributors from time to time. But not sure if they are still interested or not.

So yeah we can try to ask on Twitter!

@canvural canvural merged commit c5853f8 into larastan:master Apr 2, 2020
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

Successfully merging this pull request may close these issues.

None yet

2 participants