-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Fixed #8926, #8252 - introduce circular reference check for location parent_id - rebased from #8253 #8927
Conversation
@@ -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' |
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.
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.
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.
(Other than that, this looks great to me :) )
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.
Looks great - thank you for confirming that nullable issue. :)
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
tonull
anymore - which should fix #8926