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

empty relation shouldn't be treated as null #124

Open
olaulau opened this issue Jan 25, 2024 · 1 comment
Open

empty relation shouldn't be treated as null #124

olaulau opened this issue Jan 25, 2024 · 1 comment

Comments

@olaulau
Copy link

olaulau commented Jan 25, 2024

when retrieving a relation which return zero element, cortex gives null instead of a CortexCollection.
this is confusing, and forces us to tread those cases with custom code :

  • if I remove one element from the relation, I can come to zero element, and have to convert my empty collection to null before save
  • if the relation I get is null, I have to create a collection before adding an element to it
    any technical reason for this ?
    thanks.
@ikkez
Copy link
Owner

ikkez commented Jan 30, 2024

If i can recall correctly, it was simply because of convenient usage in templates, like
<F3:check if="{{ @user.files }}"> and so one. Having returned an empty collection would allow this condition to pass.

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

No branches or pull requests

2 participants