1

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"".    
Ralph
  • 2,065
  • 3
  • 15
  • 23
  • **OPEN_APOSTROPHE** ` – byxor Dec 07 '16 at 02:34
  • @BrandonIbbotson is it supposed to be like profile_image_thumb: OPEN_APOSTROPHE – Ralph Dec 07 '16 at 02:46
  • You're terminating your string before the `9.jpg` part. You need to [escape](http://php.net/manual/en/language.types.string.php) the apostrophes so that they aren't regarded as string terminators. – byxor Dec 07 '16 at 02:48

1 Answers1

0

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"] )>'
goto
  • 7,908
  • 10
  • 48
  • 58
  • i tried profile_image_thumb: '' and I am getting the following errors: [Nelmio\Alice\Exception\FixtureBuilder\ExpressionLanguage\LexException] Could not lex the value "["1"". – Ralph Dec 07 '16 at 22:51
  • @Ralph I've edited my answer, it seems you are not using a stable version – goto Dec 09 '16 at 07:01