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

Fixed #8926, #8252 - introduce circular reference check for location parent_id - rebased from #8253 #8927

Merged
merged 8 commits into from
Dec 19, 2020

Conversation

uberbrady
Copy link
Collaborator

This is all @travismiller 's great work on #8253 , just rebased onto develop.

He introduced a circular-reference check for Location, via the parent_id

This subsumes the old logic we had which was just to check if something was its own parent or not.

As a side-effect, we no longer need to explicitly set the Location's id to null anymore - which should fix #8926

@@ -28,7 +28,7 @@ class Location extends SnipeModel
'address2' => 'max:80|nullable',
'zip' => 'min:3|max:10|nullable',
'manager_id' => 'exists:users,id|nullable',
'parent_id' => 'nullable|exists:locations,id|different:id',
'parent_id' => 'non_circular:locations,id'
Copy link
Owner

Choose a reason for hiding this comment

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

Can you confirm that this will work with nulled parent_ids? Laravel changed the way their validator worked a while back where you have to specify nullable if it is nullable.

Copy link
Owner

Choose a reason for hiding this comment

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

(Other than that, this looks great to me :) )

Copy link
Owner

@snipe snipe left a comment

Choose a reason for hiding this comment

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

Looks great - thank you for confirming that nullable issue. :)

@snipe snipe merged commit 0329028 into snipe:develop Dec 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants