Open ak76 opened 6 years ago
Can you try again with the latest release (3.2.2)?
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
.
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.
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
Maybe '<{title_<current()>}>'
is still not working on master then
Of course. I checked it with the master and got the same result.
php: 7.1.7 symfony: 4.0.8 hautelook/alice-bundle: 2.x-dev
I have the same problem(( How did you resolve it?
@solegs
Just use simple strings or something like that: <text(100)>
Hi @ak76!
<text(100)>
- This is not exactly what I need.
I should get the object from another file.
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
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).
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 ?
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
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
still not working :'(. I did same as p4vel
hautelook/alice-bundle 2.5.1 symfony 4.3 php 7.3
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
@m0sviatoslav I think it's a different issue. But as per my comment, help is welcome
Hi, any news about this bug ?
Hi, still not working, any news ?
php: 8.1 nelmio/alice 3.10.0
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:
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];
}
'avatar' => '<fromArray(['.implode(',',$images).'], <current()>)>',
This is quite ugly, but it works.
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
Here is a result:
What am I doing wrong?