f3-cortex
f3-cortex copied to clipboard
empty relation shouldn't be treated as null
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.
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.