nelmio / alice

Expressive fixtures generator
MIT License
2.5k stars 329 forks source link

Dynamic parameters do not work as stated in the documentation #902

Open ak76 opened 6 years ago

ak76 commented 6 years ago

php: 7.0.28 symfony: 2.8.34 hautelook/alice-bundle: 2.0.0-beta.4 nelmio/alice: 3.1.3 theofidry/alice-data-fixtures: 1.0.0-beta.5

parameters:
    title_1: "title 1"
    title_2: "title 2"
    title_3: "title 3"

AppBundle\Entity\News:
  news{1..3}:
    type: 'main'
    is_top: 1
    date: '<date_create()>'
    title: '<{title_<current()>}>'
    details: '<text(500)>'
    sites: ["@site1"]

Application\Sonata\PageBundle\Entity\Site:
  site1:
    enabled: 1
    name: '<text(10)>'
    host: 'localhost'
    relative_path: '/ru'
    locale: 'ru'
    is_default: 0

Here is a result:

 ak76@ak76 sf -vvv hautelook:fixtures:load -e test
Careful, database will be purged. Do you want to continue y/N ?y
[2018-03-21 16:09:35] app.INFO: fixtures found {"files":["/project/tests/AppBundle/Fixtures/ORM/test/news.yml","/project/tests/AppBundle/Fixtures/ORM/test/site.yml"]} 

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

Exception trace:
 () at /project/vendor/nelmio/alice/src/Throwable/Exception/FixtureBuilder/ExpressionLanguage/ExpressionLanguageExceptionFactory.php:69
 Nelmio\Alice\Throwable\Exception\FixtureBuilder\ExpressionLanguage\ExpressionLanguageExceptionFactory::createForCouldNotLexValue() at /project/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Lexer/SubPatternsLexer.php:117
 Nelmio\Alice\FixtureBuilder\ExpressionLanguage\Lexer\SubPatternsLexer->lexFragment() at /project/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Lexer/SubPatternsLexer.php:84
 Nelmio\Alice\FixtureBuilder\ExpressionLanguage\Lexer\SubPatternsLexer->lex() at /project/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Lexer/StringThenReferenceLexer.php:43
 Nelmio\Alice\FixtureBuilder\ExpressionLanguage\Lexer\StringThenReferenceLexer->lex() at /project/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Lexer/FunctionLexer.php:57
 Nelmio\Alice\FixtureBuilder\ExpressionLanguage\Lexer\FunctionLexer->lex() at /project/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Lexer/GlobalPatternsLexer.php:63
 Nelmio\Alice\FixtureBuilder\ExpressionLanguage\Lexer\GlobalPatternsLexer->lex() at /project/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Lexer/ReferenceEscaperLexer.php:49
 Nelmio\Alice\FixtureBuilder\ExpressionLanguage\Lexer\ReferenceEscaperLexer->lex() at /project/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Lexer/EmptyValueLexer.php:44
 Nelmio\Alice\FixtureBuilder\ExpressionLanguage\Lexer\EmptyValueLexer->lex() at /project/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Parser/SimpleParser.php:56
 Nelmio\Alice\FixtureBuilder\ExpressionLanguage\Parser\SimpleParser->parse() at /project/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Parser/StringMergerParser.php:45
 Nelmio\Alice\FixtureBuilder\ExpressionLanguage\Parser\StringMergerParser->parse() at /project/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Parser/FunctionFixtureReferenceParser.php:48
 Nelmio\Alice\FixtureBuilder\ExpressionLanguage\Parser\FunctionFixtureReferenceParser->parse() at /project/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/SpecificationBagDenormalizer/Value/SimpleValueDenormalizer.php:67
 Nelmio\Alice\FixtureBuilder\Denormalizer\Fixture\SpecificationBagDenormalizer\Value\SimpleValueDenormalizer->parseValue() at /project/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/SpecificationBagDenormalizer/Value/SimpleValueDenormalizer.php:46
 Nelmio\Alice\FixtureBuilder\Denormalizer\Fixture\SpecificationBagDenormalizer\Value\SimpleValueDenormalizer->denormalize() at /project/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/SpecificationBagDenormalizer/Value/UniqueValueDenormalizer.php:49
 Nelmio\Alice\FixtureBuilder\Denormalizer\Fixture\SpecificationBagDenormalizer\Value\UniqueValueDenormalizer->denormalize() at /project/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/SpecificationBagDenormalizer/Property/SimplePropertyDenormalizer.php:42
 Nelmio\Alice\FixtureBuilder\Denormalizer\Fixture\SpecificationBagDenormalizer\Property\SimplePropertyDenormalizer->denormalize() at /project/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/SpecificationBagDenormalizer/SimpleSpecificationsDenormalizer.php:147
 Nelmio\Alice\FixtureBuilder\Denormalizer\Fixture\SpecificationBagDenormalizer\SimpleSpecificationsDenormalizer->denormalizeProperty() at /project/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/SpecificationBagDenormalizer/SimpleSpecificationsDenormalizer.php:105
 Nelmio\Alice\FixtureBuilder\Denormalizer\Fixture\SpecificationBagDenormalizer\SimpleSpecificationsDenormalizer->denormalize() at /project/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/Chainable/SimpleDenormalizer.php:83
 Nelmio\Alice\FixtureBuilder\Denormalizer\Fixture\Chainable\SimpleDenormalizer->denormalize() at /project/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/FixtureDenormalizerRegistry.php:62
 Nelmio\Alice\FixtureBuilder\Denormalizer\Fixture\FixtureDenormalizerRegistry->denormalize() at /project/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/Chainable/CollectionDenormalizerWithTemporaryFixture.php:170
 Nelmio\Alice\FixtureBuilder\Denormalizer\Fixture\Chainable\CollectionDenormalizerWithTemporaryFixture->denormalizeTemporaryFixture() at /project/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/Chainable/CollectionDenormalizerWithTemporaryFixture.php:127
 Nelmio\Alice\FixtureBuilder\Denormalizer\Fixture\Chainable\CollectionDenormalizerWithTemporaryFixture->denormalize() at /project/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/Chainable/SimpleCollectionDenormalizer.php:119
 Nelmio\Alice\FixtureBuilder\Denormalizer\Fixture\Chainable\SimpleCollectionDenormalizer->denormalize() at /project/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/FixtureDenormalizerRegistry.php:62
 Nelmio\Alice\FixtureBuilder\Denormalizer\Fixture\FixtureDenormalizerRegistry->denormalize() at /project/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/SimpleFixtureBagDenormalizer.php:72
 Nelmio\Alice\FixtureBuilder\Denormalizer\Fixture\SimpleFixtureBagDenormalizer->denormalize() at /project/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/SimpleDenormalizer.php:48
 Nelmio\Alice\FixtureBuilder\Denormalizer\SimpleDenormalizer->denormalize() at /project/vendor/nelmio/alice/src/FixtureBuilder/SimpleBuilder.php:41
 Nelmio\Alice\FixtureBuilder\SimpleBuilder->build() at /project/vendor/nelmio/alice/src/Loader/SimpleDataLoader.php:47
 Nelmio\Alice\Loader\SimpleDataLoader->loadData() at /project/vendor/nelmio/alice/src/Loader/SimpleFileLoader.php:49
 Nelmio\Alice\Loader\SimpleFileLoader->loadFile() at /project/vendor/theofidry/alice-data-fixtures/src/Loader/MultiPassLoader.php:100
 Fidry\AliceDataFixtures\Loader\MultiPassLoader->tryToLoadFiles() at /project/vendor/theofidry/alice-data-fixtures/src/Loader/MultiPassLoader.php:81
 Fidry\AliceDataFixtures\Loader\MultiPassLoader->load() at /project/app/cache/test/appTestDebugProjectContainer.php:12779
 FidryAliceDataFixturesLoaderMultiPassLoader_000000007c85ac6900000000611e70b3c7c1b5902e7e177868dc72eb7ce9488a->load() at /project/vendor/theofidry/alice-data-fixtures/src/Loader/PersisterLoader.php:79
 Fidry\AliceDataFixtures\Loader\PersisterLoader->load() at /project/vendor/theofidry/alice-data-fixtures/src/Loader/PurgerLoader.php:67
 Fidry\AliceDataFixtures\Loader\PurgerLoader->load() at /project/vendor/theofidry/alice-data-fixtures/src/Loader/FileResolverLoader.php:57
 Fidry\AliceDataFixtures\Loader\FileResolverLoader->load() at /project/vendor/hautelook/alice-bundle/src/Loader/DoctrineOrmLoader.php:174
 Hautelook\AliceBundle\Loader\DoctrineOrmLoader->loadFixtures() at /project/vendor/hautelook/alice-bundle/src/Loader/DoctrineOrmLoader.php:106
 Hautelook\AliceBundle\Loader\DoctrineOrmLoader->load() at /project/vendor/hautelook/alice-bundle/src/Console/Command/Doctrine/DoctrineOrmLoadDataFixturesCommand.php:139
 Hautelook\AliceBundle\Console\Command\Doctrine\DoctrineOrmLoadDataFixturesCommand->execute() at /project/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:242
 Symfony\Component\Console\Command\Command->run() at /project/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:861
 Symfony\Component\Console\Application->doRunCommand() at /project/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:193
 Symfony\Component\Console\Application->doRun() at /project/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:84
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /project/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:117
 Symfony\Component\Console\Application->run() at /project/app/console:27

What am I doing wrong?

theofidry commented 6 years ago

Can you try again with the latest release (3.2.2)?

ak76 commented 6 years ago

Sorry, I can't. Because in this case I will be forced to install hautelook/alice-bundle 2.0.0 which requires symfony 3.3 or higher. I need only use symfony 2.8.

theofidry commented 6 years ago

Then I'm not sure I can help :/

I don't have enough resources to be able to maintain older versions, so if it's not working on 3.2.2 it's a valid bug that should be fixed but if it's in a prior branch then I can't do anything about it.

Maybe the Symfony 2.8 compatibility could be added back PRs are provided, but it would be best to make sure this would solve your case first.

ak76 commented 6 years ago

Ok. I created a separate project. composer.json

{
    "name": "symfony/framework-standard-edition",
    "license": "MIT",
    "type": "project",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-4": {
            "AppBundle\\": "src/AppBundle"
        },
        "classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
    },
    "autoload-dev": {
        "psr-4": { "Tests\\": "tests/" },
        "files": [ "vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php" ]
    },
    "require": {
        "php": ">=5.5.9",
        "doctrine/doctrine-bundle": "^1.8",
        "doctrine/orm": "^2.5",
        "incenteev/composer-parameter-handler": "^2.0",
        "sensio/distribution-bundle": "^5.0.19",
        "sensio/framework-extra-bundle": "^5.0.0",
        "symfony/monolog-bundle": "^3.1.0",
        "symfony/polyfill-apcu": "^1.0",
        "symfony/swiftmailer-bundle": "^2.6.4",
        "symfony/symfony": "3.4.*",
        "twig/twig": "^1.0||^2.0"
    },
    "require-dev": {
        "doctrine/data-fixtures": "^1.3",
        "hautelook/alice-bundle": "^2.0@rc",
        "sensio/generator-bundle": "^3.0",
        "symfony/phpunit-bridge": "^3.0",
        "theofidry/alice-data-fixtures": "^1.0@rc"
    },
    "scripts": {
        "symfony-scripts": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
        ],
        "post-install-cmd": [
            "@symfony-scripts"
        ],
        "post-update-cmd": [
            "@symfony-scripts"
        ]
    },
    "config": {
        "platform": {
            "php": "7.1.15"
        },
        "sort-packages": true
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-bin-dir": "bin",
        "symfony-var-dir": "var",
        "symfony-web-dir": "web",
        "symfony-tests-dir": "tests",
        "symfony-assets-install": "relative",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        },
        "branch-alias": {
            "dev-master": "3.4-dev"
        }
    }
}

I used the same files with fixtures and got the same error.

# ak76 @ my-ubuntu in ~/projects/symfony [0:07:41] 
$ php bin/console -vvv hautelook:fixtures:load -e test
Careful, database will be purged. Do you want to continue y/N ?y
00:10:11 INFO      [app] fixtures found
[
  "files" => [
    "/projects/symfony/tests/AppBundle/Fixtures/ORM/test/news.yml"
  ]
]
[]
00:10:11 INFO      [app] Purging database with purge mode "DELETE_MODE".
[]
[]
00:10:11 INFO      [app] Loading fixtures.
[]
[]

In ExpressionLanguageExceptionFactory.php line 69:

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

Exception trace:
 Nelmio\Alice\Throwable\Exception\FixtureBuilder\ExpressionLanguage\ExpressionLanguageExceptionFactory::createForCouldNotLexValue() at /projects/symfony/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Lexer/SubPatternsLexer.php:117
 Nelmio\Alice\FixtureBuilder\ExpressionLanguage\Lexer\SubPatternsLexer->lexFragment() at /projects/symfony/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Lexer/SubPatternsLexer.php:84
 Nelmio\Alice\FixtureBuilder\ExpressionLanguage\Lexer\SubPatternsLexer->lex() at /projects/symfony/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Lexer/StringThenReferenceLexer.php:43
 Nelmio\Alice\FixtureBuilder\ExpressionLanguage\Lexer\StringThenReferenceLexer->lex() at /projects/symfony/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Lexer/FunctionLexer.php:57
 Nelmio\Alice\FixtureBuilder\ExpressionLanguage\Lexer\FunctionLexer->lex() at /projects/symfony/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Lexer/GlobalPatternsLexer.php:63
 Nelmio\Alice\FixtureBuilder\ExpressionLanguage\Lexer\GlobalPatternsLexer->lex() at /projects/symfony/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Lexer/ReferenceEscaperLexer.php:49
 Nelmio\Alice\FixtureBuilder\ExpressionLanguage\Lexer\ReferenceEscaperLexer->lex() at /projects/symfony/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Lexer/EmptyValueLexer.php:44
 Nelmio\Alice\FixtureBuilder\ExpressionLanguage\Lexer\EmptyValueLexer->lex() at /projects/symfony/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Parser/SimpleParser.php:59
 Nelmio\Alice\FixtureBuilder\ExpressionLanguage\Parser\SimpleParser->parse() at /projects/symfony/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Parser/StringMergerParser.php:45
 Nelmio\Alice\FixtureBuilder\ExpressionLanguage\Parser\StringMergerParser->parse() at /projects/symfony/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Parser/FunctionFixtureReferenceParser.php:48
 Nelmio\Alice\FixtureBuilder\ExpressionLanguage\Parser\FunctionFixtureReferenceParser->parse() at /projects/symfony/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/SpecificationBagDenormalizer/Value/SimpleValueDenormalizer.php:67
 Nelmio\Alice\FixtureBuilder\Denormalizer\Fixture\SpecificationBagDenormalizer\Value\SimpleValueDenormalizer->parseValue() at /projects/symfony/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/SpecificationBagDenormalizer/Value/SimpleValueDenormalizer.php:46
 Nelmio\Alice\FixtureBuilder\Denormalizer\Fixture\SpecificationBagDenormalizer\Value\SimpleValueDenormalizer->denormalize() at /projects/symfony/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/SpecificationBagDenormalizer/Value/UniqueValueDenormalizer.php:49
 Nelmio\Alice\FixtureBuilder\Denormalizer\Fixture\SpecificationBagDenormalizer\Value\UniqueValueDenormalizer->denormalize() at /projects/symfony/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/SpecificationBagDenormalizer/Property/SimplePropertyDenormalizer.php:42
 Nelmio\Alice\FixtureBuilder\Denormalizer\Fixture\SpecificationBagDenormalizer\Property\SimplePropertyDenormalizer->denormalize() at /projects/symfony/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/SpecificationBagDenormalizer/SimpleSpecificationsDenormalizer.php:147
 Nelmio\Alice\FixtureBuilder\Denormalizer\Fixture\SpecificationBagDenormalizer\SimpleSpecificationsDenormalizer->denormalizeProperty() at /projects/symfony/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/SpecificationBagDenormalizer/SimpleSpecificationsDenormalizer.php:105
 Nelmio\Alice\FixtureBuilder\Denormalizer\Fixture\SpecificationBagDenormalizer\SimpleSpecificationsDenormalizer->denormalize() at /projects/symfony/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/Chainable/SimpleDenormalizer.php:83
 Nelmio\Alice\FixtureBuilder\Denormalizer\Fixture\Chainable\SimpleDenormalizer->denormalize() at /projects/symfony/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/FixtureDenormalizerRegistry.php:62
 Nelmio\Alice\FixtureBuilder\Denormalizer\Fixture\FixtureDenormalizerRegistry->denormalize() at /projects/symfony/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/Chainable/CollectionDenormalizerWithTemporaryFixture.php:170
 Nelmio\Alice\FixtureBuilder\Denormalizer\Fixture\Chainable\CollectionDenormalizerWithTemporaryFixture->denormalizeTemporaryFixture() at /projects/symfony/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/Chainable/CollectionDenormalizerWithTemporaryFixture.php:127
 Nelmio\Alice\FixtureBuilder\Denormalizer\Fixture\Chainable\CollectionDenormalizerWithTemporaryFixture->denormalize() at /projects/symfony/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/Chainable/SimpleCollectionDenormalizer.php:119
 Nelmio\Alice\FixtureBuilder\Denormalizer\Fixture\Chainable\SimpleCollectionDenormalizer->denormalize() at /projects/symfony/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/FixtureDenormalizerRegistry.php:62
 Nelmio\Alice\FixtureBuilder\Denormalizer\Fixture\FixtureDenormalizerRegistry->denormalize() at /projects/symfony/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/SimpleFixtureBagDenormalizer.php:85
 Nelmio\Alice\FixtureBuilder\Denormalizer\Fixture\SimpleFixtureBagDenormalizer->denormalize() at /projects/symfony/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/SimpleDenormalizer.php:48
 Nelmio\Alice\FixtureBuilder\Denormalizer\SimpleDenormalizer->denormalize() at /projects/symfony/vendor/nelmio/alice/src/FixtureBuilder/SimpleBuilder.php:41
 Nelmio\Alice\FixtureBuilder\SimpleBuilder->build() at /projects/symfony/vendor/nelmio/alice/src/Loader/SimpleDataLoader.php:47
 Nelmio\Alice\Loader\SimpleDataLoader->loadData() at /projects/symfony/vendor/nelmio/alice/src/Loader/SimpleFilesLoader.php:65
 Nelmio\Alice\Loader\SimpleFilesLoader->loadFiles() at /projects/symfony/vendor/theofidry/alice-data-fixtures/src/Loader/SimpleLoader.php:53
 Fidry\AliceDataFixtures\Loader\SimpleLoader->load() at /projects/symfony/vendor/theofidry/alice-data-fixtures/src/Loader/PersisterLoader.php:77
 Fidry\AliceDataFixtures\Loader\PersisterLoader->load() at /projects/symfony/vendor/theofidry/alice-data-fixtures/src/Loader/PurgerLoader.php:119
 Fidry\AliceDataFixtures\Loader\PurgerLoader->load() at /projects/symfony/vendor/theofidry/alice-data-fixtures/src/Loader/FileResolverLoader.php:73
 Fidry\AliceDataFixtures\Loader\FileResolverLoader->load() at /projects/symfony/vendor/hautelook/alice-bundle/src/Loader/DoctrineOrmLoader.php:184
 Hautelook\AliceBundle\Loader\DoctrineOrmLoader->loadFixtures() at /projects/symfony/vendor/hautelook/alice-bundle/src/Loader/DoctrineOrmLoader.php:117
 Hautelook\AliceBundle\Loader\DoctrineOrmLoader->load() at /projects/symfony/vendor/hautelook/alice-bundle/src/Console/Command/Doctrine/DoctrineOrmLoadDataFixturesCommand.php:138
 Hautelook\AliceBundle\Console\Command\Doctrine\DoctrineOrmLoadDataFixturesCommand->execute() at /projects/symfony/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:252
 Symfony\Component\Console\Command\Command->run() at /projects/symfony/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:964
 Symfony\Component\Console\Application->doRunCommand() at /projects/symfony/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:86
 Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /projects/symfony/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:248
 Symfony\Component\Console\Application->doRun() at /projects/symfony/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:74
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /projects/symfony/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:148
 Symfony\Component\Console\Application->run() at /projects/symfony/bin/console:27
theofidry commented 6 years ago

Maybe '<{title_<current()>}>' is still not working on master then

ak76 commented 6 years ago

Of course. I checked it with the master and got the same result.

solegs commented 6 years ago

php: 7.1.7 symfony: 4.0.8 hautelook/alice-bundle: 2.x-dev

I have the same problem(( How did you resolve it?

ak76 commented 6 years ago

@solegs Just use simple strings or something like that: <text(100)>

solegs commented 6 years ago

Hi @ak76! <text(100)> - This is not exactly what I need. I should get the object from another file.

theofidry commented 6 years ago

I can't check it at the moment but PRs are welcomed. The best way to get started is a quick read of the contributor guide where there is some tips and checking ParserIntegrationTest

c33s commented 5 years ago

using the alice fixture loader from doctrine fixture loader.

parameters:
    artist_1: H. R. Giger
App\Entity\Artist:
    artist_{1..1}:
        idByString: <uuid()>
        name: '<{artist_<current()>}>'
  [Nelmio\Alice\Throwable\Exception\FixtureBuilder\ExpressionLanguage\ParseException]
  Could not parse the token "Function(<current()>" (type: FUNCTION_TYPE).
lucassimonin commented 5 years ago
parameters:
    stock_1: 10
    stock_2: 0
App\Entity\ProductLog:
    productLog{1..2}:
        stock: '<{stock_<current()>}>'
In ExpressionLanguageExceptionFactory.php line 69:

  Could not lex the value ">".

I have the same issue. Can you do something ?

theofidry commented 5 years ago

I'll do something about it when I'll find some time but frankly speaking it's not on the top priority list as I have a couple of more pressing issues on AliceDataFixtures and HautelookAliceBundle to tackle first. So the best way to make the issue move forward is to help out

p4veI commented 5 years ago

I'm trying to figure out a way around it, did anyone here find out anything that could help to solve this problem?

I'm currently trying to dynamically pass relations to fixtures e.g.:

parameters:
    role_user: 'user'
    role_superadmin: 'superadmin'

Credentials:
    testing_account_credentials_{user, superadmin}:
        #credentials also contain dynamic relation to other fixtures

\Account:
    testing_account_{user, superadmin}:
        id: 10
        credentials: '@testing_account_credentials_<current()>'
        role: '<{role_<current()>}>'

and then I'm getting a similar error, the same @c33s posted earlier:

Error: An error occurred while denormalizing the fixture "testing_account_{user, superadmin}" (Account): Could not parse the token "nction(<current()>" (type: FUNCTION_TYPE).

#stack trace

Caused by
Nelmio\Alice\Throwable\Exception\FixtureBuilder\ExpressionLanguage\ParseException: Could not parse the token "nction(<current()>" (type: FUNCTION_TYPE).

EDIT: I'm running on the latest version of the nelmio\alice package v3.5.6, php 7.2 and symfony 4.0.3

karael commented 5 years ago

still not working :'(. I did same as p4vel

hautelook/alice-bundle 2.5.1 symfony 4.3 php 7.3

m0sviatoslav commented 5 years ago

php 7.3 hautelook/alice-bundle 2.5.1 nelmio/alice 3.5.7 theofidry/alice-data-fixtures 1.1.1

parameters:
  number: <numberBetween(1, 100)>

App\Entity\Entity:
  entity_{1..20}:
    name: <company()>
    description: <text()>
    association: '@association_<{number}>'
    parent: '@association_<{number}>->parent'

Could not find the fixture "association_".

Seems the number is empty

theofidry commented 5 years ago

@m0sviatoslav I think it's a different issue. But as per my comment, help is welcome

dlasserre commented 3 years ago

Hi, any news about this bug ?

paulovma commented 2 years ago

Hi, still not working, any news ?

php: 8.1 nelmio/alice 3.10.0

yarooze commented 5 months ago

Seems that the AK76's problem still exists. I've got this error today.

"nelmio/alice": "^3.13",

parameters:
    avatar_0: 'img0.png'
    avatar_1: 'img1.png'
   ..
    avatar_100: 'img100.png'

User:
     'user_{1..100}':
        'avatar' => '<{avatar_<current()>}>'
An error occurred while denormalizing the fixture "user_{1..100}" (App\Entity\User): Could not parse the token "Function(<current()>" (type: FUNCTION_TYPE).

Just for the case.

My quick and ugly solution is:

  1. Register another provider with the method: "fromArray"
    final class ValueProvider extends Base
    {
    public function fromArray($array = [], $key = null): string
    {
        if ($key === null || empty($array[$key])) {
            $key = array_rand($array);
        }
        return $array[$key];
    }
  2. Call it with both variables
    'avatar' => '<fromArray(['.implode(',',$images).'], <current()>)>',

This is quite ugly, but it works.