Hautleook/AliceBundle fixture yml configuration with randomElement faker function

1k Views Asked by At

I am trying to configure the yml file for Hauleook/AliceBundle fixture.

Project\MainBundle\Entity\Manager:
   manager_{1..30}:
      name: '<firstName()> <lastName()>'
      profile_image: '9.jpg'
      profile_image_thumb: '<randomElement(['9.jpg','10.jpg'])'

And I am getting the following error message when i tried to run

bin/console hautelook:fixtures:load

  [Nelmio\Alice\Exception\FixtureBuilder\ExpressionLanguage\LexException]  
  Could not lex the value "["10.jpg"".    
1

There are 1 best solutions below

2
goto On BEST ANSWER

It seems that you are using the 3.0.0.beta version can you downgrade to a stable version?

In 2.2.2 this syntax works for me:

'<randomElement( ["1", "2"] )>'