Hautleook / AliceBundle夹具yml配置与randomElement faker功能

时间:2016-12-07 00:48:29

标签: php symfony alice-fixtures

我正在尝试为Hauleook / AliceBundle fixture配置yml文件。

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

我尝试运行时收到以下错误消息

bin / console hautelook:fixtures:load

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

1 个答案:

答案 0 :(得分:0)

您似乎在使用3.0.0.beta版本可以降级到稳定版本吗?

在2.2.2中,这种语法对我有用:

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