#126 Has and belongs to many ignores class_name#127
Merged
shmax merged 5 commits intophp-activerecord:masterfrom Sep 16, 2025
Merged
Conversation
…erage for explicit class names
5cf3054 to
9dbd9d7
Compare
shmax
reviewed
Sep 15, 2025
| { | ||
| if ($this->has_relationship($name)) { | ||
| return $this->relationships[$name]; | ||
| foreach ($this->relationships as $relationship) { |
Contributor
There was a problem hiding this comment.
Giving a general class like Table knowledge of a specific relationship type seems a little fishy to me. Is attribute_name not resolving to what we expect it to?
Contributor
Author
There was a problem hiding this comment.
You are correct that not is buisness
And we can't simply use attribute_name in HasAndBelongsToMany the name will have for example "custom_workers" and he will search for a relationsship the other side named "custom_workers" and he will not find one.
…date usage in HasAndBelongsToMany and Table classes
…ss_name since join_table will alway be unique
Contributor
|
@EthannSchneider Your tests pass, and from what little research I've done this looks fine to me, but I didn't test or do any debugging, so I'm going to trust you on the rest. Thanks much! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#126