Skip to content

Conversation

shmax
Copy link
Contributor

@shmax shmax commented Sep 15, 2023

An attempt at implementing HasAndBelongsToMany (which was marked with "TODO: implement" in the original code, and evidently never completed) functionality:

  • create new Student and Courses fixtures (every student attends many courses, every course is attended by many students)
  • remove get_relationship stuff from RelationshipTest (a horrible anti-pattern, IMO)
  • create HasManyAndBelongsToMany type, and convert to a array<string, HasManyAndBelongsToMany> format (for easier static checking)

Note that this is just the read part of this; I'm not sure what to do about writes, because as far as I can tell none of the other relationship classes currently support writes (ie build and create don't actually create new records).

@codecov
Copy link

codecov bot commented Sep 15, 2023

Codecov Report

Merging #76 (f91b12a) into master (aeebc0d) will increase coverage by 0.29%.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##             master      #76      +/-   ##
============================================
+ Coverage     96.26%   96.55%   +0.29%     
- Complexity      960      962       +2     
============================================
  Files            33       33              
  Lines          2328     2351      +23     
============================================
+ Hits           2241     2270      +29     
+ Misses           87       81       -6     
Files Changed Coverage Δ
lib/Model.php 98.03% <ø> (ø)
lib/Relationship/AbstractRelationship.php 99.24% <100.00%> (ø)
lib/Relationship/HasAndBelongsToMany.php 86.20% <100.00%> (+86.20%) ⬆️
lib/Table.php 97.66% <100.00%> (+0.96%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@shmax shmax changed the title set up options Start on HasAndBelongsToMany Sep 15, 2023
@shmax shmax force-pushed the has-belongs-to-many branch from b0e6c78 to 0425580 Compare September 16, 2023 18:39
@shmax shmax marked this pull request as ready for review September 16, 2023 22:59
@shmax shmax merged commit 10dacd4 into master Sep 16, 2023
@shmax shmax deleted the has-belongs-to-many branch September 16, 2023 23:07
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.

1 participant