Closed zajca closed 7 years ago
if it only for tests - reflection can be used
I'm using Alice fixture generator https://github.com/nelmio/alice which will do clone by default. this is what I'm doing most of the time:
EntityClass:
name_{1..10}:
type: <randomElement(<(MyTypeEnum::getEnumerators())>)>
@zajca enumerators are not clonable as every enumerator should exist only once.
Also I don't really get your point of using a faker library to get enumerators as they are fixed defined by your enumeration. But as workaround you could use the enumerator values and later get the instance by value if you require the instance.
Allow clone enum. This will allow to use enum with fixtures generators.