-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Add twoWayKey checks and multiple many-to-many restrictions #7153
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
app/controllers/api/databases.php
Outdated
if ( | ||
$type === Database::RELATION_MANY_TO_MANY && | ||
$attribute->getAttribute('type') === Database::VAR_RELATIONSHIP && | ||
$attribute->getAttribute('options')['relationType'] === Database::RELATION_MANY_TO_MANY && | ||
$attribute->getAttribute('options')['relatedCollection'] === $relatedCollection->getId() | ||
) { | ||
throw new Exception(Exception::ATTRIBUTE_ALREADY_EXISTS, 'Creating more than one "manyToMany" relationship on the same collection is currently not permitted.'); | ||
} |
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.
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.
Currently we do not have this option in Utopia , Definitely something to improve in the future.
The issue you mention here sounds like the reason we are restricting this for now.
� Conflicts: � composer.lock
Fix for relations attributes when twoWayKey variable is not passed in API,
We do not want the worker to throw the Error
Until now, it was checked only for twoWay = true
Added a validation to prevent the creation of 2 manyToMany relations between the same collections
#6281