Closed tarik-hatim closed 6 years ago
Hi,
Please provide which libraries and version you are using (composer show
) and you can check the more detailed stack trace with the -vvv
option. However note that 3.3 is not supported and without seeing how you are using alice and what your fixtures looks like I'm afraid it's a bit hard to provide any help
i missed the reflection to put all the necessary elements.
Fixtures in YML file :
AppBundle\Entity\Genus:
genus{1..10}:
name: <name()>
subFamily: <text(20)>
speciesCount: <numberBetween(100, 1000)>
funFact: <sentence()>
isPublished: <boolean(75)>
AppBundle\Entity\GenusNote:
genus.note_{1..100}:
username: <userName()>
userAvatarFileName: '50%? leanna.jpeg : ryan.jpeg'
note: <paragraph()>
createdAt: <dateTimeBetween('-6 months', 'now')>
Configutation :
"require": {
"php": ">=5.5.9",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/doctrine-cache-bundle": "^1.3",
"doctrine/doctrine-migrations-bundle": "^1.3",
"doctrine/orm": "^2.5",
"incenteev/composer-parameter-handler": "^2.0",
"knplabs/knp-markdown-bundle": "^1.7",
"sensio/distribution-bundle": "^5.0.19",
"sensio/framework-extra-bundle": "^3.0.2",
"symfony/monolog-bundle": "^3.1.0",
"symfony/polyfill-apcu": "^1.0",
"symfony/swiftmailer-bundle": "^2.3.10",
"symfony/symfony": "3.3.*",
"twig/twig": "^1.0||^2.0",
"hautelook/alice-bundle": "~2.1"
},
"conflict": {
"nelmio/alice": "<=2.1.1"
},
"minimum-stability": "dev",
Class for Loading the Fixtures
namespace AppBundle\FixtureData\ORM;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\Persistence\ObjectManager;
use Nelmio\Alice\Loader\NativeLoader;
class loadFixtures extends Fixture
{
public function load(ObjectManager $manager)
{
$loader = new NativeLoader();
$objectSet = $loader->loadFile(__dir__.'/Fixtures.yml');
}
}
Full Stack Trace
Exception trace:
() at C:\xampp\htdocs\aqua_note\vendor\fzaninotto\faker\src\Faker\Provider\Base.php:194
Faker\Provider\Base::randomElements() at C:\xampp\htdocs\aqua_note\vendor\fzaninotto\faker\src\Faker\Provider\Base.php:212
Faker\Provider\Base::randomElement() at C:\xampp\htdocs\aqua_note\vendor\fzaninotto\faker\src\Faker\Provider\Person.php:54
Faker\Provider\Person->name() at n/a:n/a
call_user_func_array() at C:\xampp\htdocs\aqua_note\vendor\fzaninotto\faker\src\Faker\Generator.php:222
Faker\Generator->format() at C:\xampp\htdocs\aqua_note\vendor\nelmio\alice\src\Generator\Resolver\Value\Chainable\FakerFunctionCallValueResolver.php:69
Nelmio\Alice\Generator\Resolver\Value\Chainable\FakerFunctionCallValueResolver->resolve() at C:\xampp\htdocs\aqua_note\vendor\nelmio\alice\src\Generator\Resolver\Value\Chainable\PhpFunctionCallValueResolver.php:74
Nelmio\Alice\Generator\Resolver\Value\Chainable\PhpFunctionCallValueResolver->resolve() at C:\xampp\htdocs\aqua_note\vendor\nelmio\alice\src\Generator\Resolver\Value\Chainable\FunctionCallArgumentResolver.php:94
Nelmio\Alice\Generator\Resolver\Value\Chainable\FunctionCallArgumentResolver->resolve() at C:\xampp\htdocs\aqua_note\vendor\nelmio\alice\src\Generator\Resolver\Value\ValueResolverRegistry.php:84
Nelmio\Alice\Generator\Resolver\Value\ValueResolverRegistry->resolve() at C:\xampp\htdocs\aqua_note\vendor\nelmio\alice\src\Generator\Hydrator\SimpleHydrator.php:80
Nelmio\Alice\Generator\Hydrator\SimpleHydrator->hydrate() at C:\xampp\htdocs\aqua_note\vendor\nelmio\alice\src\Generator\ObjectGenerator\SimpleObjectGenerator.php:103
Nelmio\Alice\Generator\ObjectGenerator\SimpleObjectGenerator->completeObject() at C:\xampp\htdocs\aqua_note\vendor\nelmio\alice\src\Generator\ObjectGenerator\SimpleObjectGenerator.php:91
Nelmio\Alice\Generator\ObjectGenerator\SimpleObjectGenerator->generate() at C:\xampp\htdocs\aqua_note\vendor\nelmio\alice\src\Generator\ObjectGenerator\CompleteObjectGenerator.php:53
Nelmio\Alice\Generator\ObjectGenerator\CompleteObjectGenerator->generate() at C:\xampp\htdocs\aqua_note\vendor\nelmio\alice\src\Generator\DoublePassGenerator.php:60
Nelmio\Alice\Generator\DoublePassGenerator->generateFixtures() at C:\xampp\htdocs\aqua_note\vendor\nelmio\alice\src\Generator\DoublePassGenerator.php:51
Nelmio\Alice\Generator\DoublePassGenerator->generate() at C:\xampp\htdocs\aqua_note\vendor\nelmio\alice\src\Loader\SimpleDataLoader.php:49
Nelmio\Alice\Loader\SimpleDataLoader->loadData() at C:\xampp\htdocs\aqua_note\vendor\nelmio\alice\src\Loader\SimpleFileLoader.php:49
Nelmio\Alice\Loader\SimpleFileLoader->loadFile() at C:\xampp\htdocs\aqua_note\vendor\nelmio\alice\src\Loader\NativeLoader.php:260
Nelmio\Alice\Loader\NativeLoader->loadFile() at C:\xampp\htdocs\aqua_note\src\AppBundle\FixtureData\ORM\loadFixtures.php:14
AppBundle\FixtureData\ORM\loadFixtures->load() at C:\xampp\htdocs\aqua_note\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Executor\AbstractExecutor.php:121
Doctrine\Common\DataFixtures\Executor\AbstractExecutor->load() at C:\xampp\htdocs\aqua_note\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Executor\ORMExecutor.php:88
Doctrine\Common\DataFixtures\Executor\ORMExecutor->Doctrine\Common\DataFixtures\Executor\{closure}() at n/a:n/a
call_user_func() at C:\xampp\htdocs\aqua_note\vendor\doctrine\orm\lib\Doctrine\ORM\EntityManager.php:233
Doctrine\ORM\EntityManager->transactional() at C:\xampp\htdocs\aqua_note\var\cache\dev\appDevDebugProjectContainer.php:6919
DoctrineORMEntityManager_0000000025a3b518000000000c8edb03248c9728a1f5e27b005eca5c3a4c04cd->transactional() at C:\xampp\htdocs\aqua_note\vendor\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Executor\ORMExecutor.php:9
0
Doctrine\Common\DataFixtures\Executor\ORMExecutor->execute() at C:\xampp\htdocs\aqua_note\vendor\doctrine\doctrine-fixtures-bundle\Command\LoadDataFixturesDoctrineCommand.php:105
Doctrine\Bundle\FixturesBundle\Command\LoadDataFixturesDoctrineCommand->execute() at C:\xampp\htdocs\aqua_note\vendor\symfony\symfony\src\Symfony\Component\Console\Command\Command.php:264
Symfony\Component\Console\Command\Command->run() at C:\xampp\htdocs\aqua_note\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:887
Symfony\Component\Console\Application->doRunCommand() at C:\xampp\htdocs\aqua_note\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:223
Symfony\Component\Console\Application->doRun() at C:\xampp\htdocs\aqua_note\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:81
Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at C:\xampp\htdocs\aqua_note\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:130
Symfony\Component\Console\Application->run() at C:\xampp\htdocs\aqua_note\bin\console:28
Your fixtures look alright at least.
I can't say anything about your dependencies though: a excerpt of the composer.json
only shows your dependencies constraint, not the actual dependencies (and which version) is installed. Use composer show
for that.
You should check the values passed toFaker\Provider\Base::randomElement()
to see what is going on and where the bug comes from.
Also note that the way you are loading your fixtures is done with DoctrineFixturesBundle
, not HautelookAliceBundle
, I really suggest you to make your mind and pick one of them as they are redundant.
okey here is the list of composer show :
C:\xampp\htdocs\aqua_note>composer show
composer/ca-bundle 1.0.7 Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.
doctrine/annotations v1.2.7 Docblock Annotations Parser
doctrine/cache v1.6.1 Caching library offering an object-oriented API for many cache backends
doctrine/collections v1.3.0 Collections Abstraction library
doctrine/common v2.6.2 Common Library for Doctrine projects
doctrine/data-fixtures v1.3.0 Data Fixtures for all Doctrine Object Managers
doctrine/dbal v2.5.12 Database Abstraction Layer
doctrine/doctrine-bundle 1.6.8 Symfony DoctrineBundle
doctrine/doctrine-cache-bundle 1.3.3 Symfony Bundle for Doctrine Cache
doctrine/doctrine-fixtures-bundle 3.0.2 Symfony DoctrineFixturesBundle
doctrine/doctrine-migrations-bundle v1.3.1 Symfony DoctrineMigrationsBundle
doctrine/inflector v1.1.0 Common String Manipulations with regard to casing and singular/plural rules.
doctrine/instantiator 1.0.5 A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer v1.0.1 Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
doctrine/migrations v1.5.0 Database Schema migrations using Doctrine DBAL
doctrine/orm v2.5.6 Object-Relational-Mapper for PHP
fig/link-util 1.0.0 Common utility implementations for HTTP links
fzaninotto/faker v1.7.1 Faker is a PHP library that generates fake data for you.
hautelook/alice-bundle dev-master a4e4f39 Symfony bundle to manage fixtures with Alice and Faker.
incenteev/composer-parameter-handler v2.1.2 Composer script handling your ignored parameter file
jdorn/sql-formatter v1.2.17 a PHP SQL highlighting library
knplabs/knp-markdown-bundle 1.7.0 Knplabs markdown bundle transforms markdown into html
michelf/php-markdown 1.8.0 PHP Markdown
monolog/monolog 1.22.1 Sends your logs to files, sockets, inboxes, databases and various web services
myclabs/deep-copy 1.7.0 Create deep copies (clones) of your objects
nelmio/alice v3.1.3 Expressive fixtures generator
ocramius/package-versions 1.3.0 Composer plugin that provides efficient querying for installed package versions (no runtime IO)
ocramius/proxy-manager 2.1.1 A library providing utilities to generate, instantiate and generally operate with Object Proxies
paragonie/random_compat v2.0.10 PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
psr/cache 1.0.1 Common interface for caching libraries
psr/container 1.0.0 Common Container Interface (PHP FIG PSR-11)
psr/link 1.0.0 Common interfaces for HTTP links
psr/log 1.0.2 Common interface for logging libraries
psr/simple-cache 1.0.0 Common interfaces for simple caching
sensio/distribution-bundle v5.0.20 Base bundle for Symfony Distributions
sensio/framework-extra-bundle v3.0.26 This bundle provides a way to configure your controllers with annotations
sensio/generator-bundle v3.1.4 This bundle generates code for you
sensiolabs/security-checker v4.0.4 A security checker for your composer.lock
swiftmailer/swiftmailer v5.4.8 Swiftmailer, free feature-rich PHP mailer
symfony/monolog-bundle v3.1.0 Symfony MonologBundle
symfony/phpunit-bridge v3.3.2 Symfony PHPUnit Bridge
symfony/polyfill-apcu v1.3.0 Symfony polyfill backporting apcu_* functions to lower PHP versions
symfony/polyfill-intl-icu v1.3.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-mbstring v1.3.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php56 v1.3.0 Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions
symfony/polyfill-php70 v1.3.0 Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
symfony/polyfill-util v1.3.0 Symfony utilities for portability of PHP codes
symfony/swiftmailer-bundle v2.6.2 Symfony SwiftmailerBundle
symfony/symfony v3.3.2 The Symfony PHP framework
theofidry/alice-data-fixtures v1.0.1 Nelmio alice extension to persist the loaded fixtures.
twig/twig v1.34.2 Twig, the flexible, fast, and secure template language for PHP
zendframework/zend-code 3.3.0 provides facilities to generate arbitrary code using an object oriented interface
zendframework/zend-eventmanager 3.2.0 Trigger and listen to events within a PHP application
I'm sorry i was following a course in witch the instructor suggested aliceBundle, then i realized that we are not in the same configurations (he used aliceBundle in conjunction with fixturesBundle). for Symfony there is another bundle witch is called HautelookAliceBundle that is configured diffrently. i'm using it currently but this time i'm getting the same error with a different offset value (-3 instead of -5) . someone on the internet is suggesting to downgrade the version of fzaninotto to 1.6 witch solved the problem.
Thank for all
So it looks like there may be a BC break with Faker then. This should be investigated
I can't reproduce it with Faker 1.8+ so I suspect it was a regression in Faker which has been solved since then
hello there,
i'm getting this error while trying to generate fake data in symfony 3.3.2 :