data-fixtures
data-fixtures copied to clipboard
Ordering fixtures: Undefined index: %loader class% in .../DataFixtures/Loader.php on line 330
When I add order to fixtures, I got notice:
PHP Notice: Undefined index: Acme\DemoBundle\DataFixtures\ORM\LoadDemoData in /var/www/symfony/vendor/doctrine/data-fixtures/lib/Doctrine/Common/DataFixtures/Loader.php on line 330
PHP Stack trace:
PHP 1. {main}() /var/www/symfony/app/console:0
PHP 2. Symfony\Component\Console\Application->run() /var/www/symfony/app/console:27
PHP 3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() /var/www/symfony/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:121
PHP 4. Symfony\Component\Console\Application->doRun() /var/www/symfony/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:96
PHP 5. Symfony\Component\Console\Application->doRunCommand() /var/www/symfony/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:191
PHP 6. Symfony\Component\Console\Command\Command->run() /var/www/symfony/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:902
PHP 7. Common\CommonBundle\Command\ClearDatabaseCommand->execute() /var/www/symfony/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:241
PHP 8. Symfony\Component\Console\Command\Command->run() /var/www/symfony/src/Common/CommonBundle/Command/ClearDatabaseCommand.php:55
PHP 9. Doctrine\Bundle\FixturesBundle\Command\LoadDataFixturesDoctrineCommand->execute() /var/www/symfony/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:241
PHP 10. Doctrine\Common\DataFixtures\Loader->getFixtures() /var/www/symfony/vendor/doctrine/doctrine-fixtures-bundle/Doctrine/Bundle/FixturesBundle/Command/LoadDataFixturesDoctrineCommand.php:94
PHP 11. Doctrine\Common\DataFixtures\Loader->orderFixturesByDependencies() /var/www/symfony/vendor/doctrine/data-fixtures/lib/Doctrine/Common/DataFixtures/Loader.php:164
PHP 12. Doctrine\Common\DataFixtures\Loader->getUnsequencedClasses() /var/www/symfony/vendor/doctrine/data-fixtures/lib/Doctrine/Common/DataFixtures/Loader.php:274
> loading [0] Acme\DemoBundle\DataFixtures\ORM\LoadDemoData
> loading [1] Acme\Demo2Bundle\DataFixtures\ORM\LoadDemo2Data
Class is:
class LoadDemoData extends AbstractFixture implements OrderedFixtureInterface
{
/**
* {@inheritDoc}
*/
public function load(ObjectManager $manager)
{
$object = new Demo();
// ....
$manager->persist($object);
$manager->flush();
$this->addReference('object-1', $object);
}
public function getOrder()
{
return 0;
}
}
Without order no notice.
I'm having the same problem, seems to happen to DependantFixtures too.
Any news on this ? It happens when there is dependency on OrderedFixture
I can’t replicate this issue. There are also tests for mixed fixtures. Can you provide a test case with up-to-date data-fixtures? Use dev-master
, not v1.0.0
.
This is still an issue. Please see #198
@brabeji Thanks for pointing this in test, I did not have time to do that. Your test is correct as I mentioned It happens when there is dependant fixture that depends on OrderedFixture
:+1:
:+1:
Have the same issue How to reproduce
FixtureA implement DependentFixtureInterface
FixtureB implement DependentFixtureInterface
FixtureC implement DependentFixtureInterface
FixtureD implement OrderedFixtureInterface
FixtureA depends on FixtureB
FixtureB depends on FixtureC && FixtureD
As result on php7 we recived the exception
[Symfony\Component\Debug\Exception\ContextErrorException]
Notice: Undefined index: FixtureD
Still actual in 2020
Still actual in 2021