-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Refactor relationships #971
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #971 +/- ##
==========================================
+ Coverage 36.8% 37.9% +1.1%
Complexity 11 11
==========================================
Files 192 193 +1
Lines 5225 5119 -106
==========================================
+ Hits 1919 1936 +17
+ Misses 3306 3183 -123
Continue to review full report at Codecov.
|
| 'name' => 'boss', | ||
| 'name_reverse_relationship' => 'boss', | ||
| 'relationship_type_group_id' => $id, | ||
| ]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should you not add a relation colleague<=>boss ?
|
This PR would close #117 too right ? |
…to replace-relationships
asbiin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job !!
app/Account.php
Outdated
| // create new account | ||
| $account = new self; | ||
| $account->api_key = str_random(30); | ||
| $account->created_at = Carbon::now(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should use now() helper - see #1051
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| */ | ||
| public function getRelationshipTypeByType(string $relationshipTypeName) | ||
| { | ||
| return $this->relationshipTypes->where('name', $relationshipTypeName)->first(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add ->get() to return the object, and not the Query\Builder instance
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get would return a collection, I need a single item.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok ok
| {{ csrf_field() }} | ||
| </form> | ||
| <p class="mb0"> | ||
| <a href="/people/{{ $contact->id }}/relationships/new?type={{ $contact->account->getRelationshipTypeByType('child')->id }}">Add</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Add" should be localized
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done
| @include('people.relationship._relationship', ['relationships' => $workRelationships]) | ||
|
|
||
| <p class="mb0"> | ||
| <a href="/people/{{ $contact->id }}/relationships/new?type={{ $contact->account->getRelationshipTypeByType('friend')->id }}">Add</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Add" should be localized
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done
…to replace-relationships
|
This pull request has been automatically locked since there |
This is a massive change of the codebase, including some breaking changes in the API.
This is the first step to address #19 (set relationship to a person) and #117.
The idea is
relationship_typeswhich would allow any type of relationships between two persons.The scope of this PR is not to allow custom relationships now. It is to have the equivalent of what we have now, with the new tables structure, make sure it works. It has to be transparent to the user.
The new system manages masculine/feminine of each relationship type (and localized too), like
Father/mother,daughter/son, etc...Each new relationship type belongs to a relationship type group. For instance,
daughter/sontype belongs to theFamilyrelationship type group.Here are the relationship types that we are going to introduce:
Remaining tasks
vCardand.csvfiles.UNRELEASED.