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
Alice has support for picking a random item using the wildcard syntax: @element*. This works great when I've generated fixtures using a loop, ending up with @element1, @element2 ... @elementN.
Where values aren't random (e.g. settings, statuses) and I manually create the fixtures, I give them descriptive names so I can easily reference them in other manually created fixtures. E.g.:
App\Entity\Status:
success:
...
failure: # Easier to remember than @status2
...
But in the generated fixtures, I need to pick a random status.
I have tried: <randomElement([@success, @failure])>, <randomElement(['@success', '@failure'])>, defining a parameter that's an array of the statuses; all give the error:
Expected argument of type "App\Entity\Setting\Status or null", "Nelmio\Alice\Definition\Value\FixtureReferenceValue" given at property path "status".
Is it possible to pick a random element from a user-defined set?
The text was updated successfully, but these errors were encountered:
Alice has support for picking a random item using the wildcard syntax:
@element*
. This works great when I've generated fixtures using a loop, ending up with@element1
,@element2
...@elementN
.Where values aren't random (e.g. settings, statuses) and I manually create the fixtures, I give them descriptive names so I can easily reference them in other manually created fixtures. E.g.:
But in the generated fixtures, I need to pick a random status.
I have tried:
<randomElement([@success, @failure])>
,<randomElement(['@success', '@failure'])>
, defining a parameter that's an array of the statuses; all give the error:Is it possible to pick a random element from a user-defined set?
The text was updated successfully, but these errors were encountered: