You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If $contacts is null, then NullContext is created, and view is rendered properly. If $contacts has array with entities, then EntityContext is created, and first entity is given to next processing. But if array is empty, then EntityContext is created, but it can't recognize an entity and throw exception.
What do you think should happen? The entity context needs an entity to operate. At best we could switch to using a NullContext when the result set is empty.
I understand reason of exception, but I think application should behave different in this case. If Form::create accepts list, then it should expect that list may be empty.
An empty collection should not fall into the EntityContext as it will
cause errors downstream. Instead of just sniffing against Travserable,
using a temporary Collection to access the first element will give
a better test of what is in an object/array.
Fixes#4698
When I build form based on search result with multiple entities, I have an error if query result is empty.
e.g.:
If $contacts is null, then NullContext is created, and view is rendered properly. If $contacts has array with entities, then EntityContext is created, and first entity is given to next processing. But if array is empty, then EntityContext is created, but it can't recognize an entity and throw exception.
I think, in FormHelper.php should be:
The text was updated successfully, but these errors were encountered: