Collection Of Specific Objects With Empty Collection Not Allowed? #765
Unanswered
TheFerrettDeveloper
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Use a default? public Collection $search_terms = new Collection() Only allowed in constructors if I'm not mistaken |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
So I have this field on a data object:
/** @var Collection <int, SearchTerms> */
public Collection $search_terms
Yet whenever I initiate it with an empty Collection (as not every search has these terms), I'm getting an error that "The search terms field is required".
Is that... expected behavior? Is there a way to say "It's a Collection of these objects, but no objects is also okay?"
Beta Was this translation helpful? Give feedback.
All reactions