Closed mdavis1982 closed 11 years ago
Would it be possible to do something like:
biography: <paragraphs({1-10})>
For a random number between 1 and 10 paragraphs?
The stuff inside ()
in provider calls is pretty much php run through eval, so I believe you can do <paragraphs(rand(0, 4))>
.
You can...
But that's not what I'm asking. Ideally, I want to have multiple paragraphs, separated by newlines as a single string. That doesn't seems to be possible?
Imagine, for example, an article that you want to fake. That would have lots of text (paragraphs) all separated by newlines. It doesn't seem to be possible to actually do this with Alice?
@mdavis1982 Use this
biography: <paragraphs(4, true)>
In an entity, I have a text field that I use to store biographies of people. These are plain text and need to be multiple paragraphs. I saw the
paragraphs()
provider in the Faker documentation and thought I would be able to use that, but wanted a random number of them.So, for example:
This doesn't work because it returns 3 separate strings, and I needed a single string concatenated with newlines.
I also wanted to have a random number of these so I tried:
That also doesn't work because it isn't parsed correctly. I also tried:
But that puts
3x lorem...
into the column in the database. Is it possible to have a random number of paragraphs, separated by newlines added to a field?