doctrine fixtures code example

Example 1: fixtures symfony

php bin/console doctrine:fixtures:load

Example 2: doctrine fixture bundle

// Symfony 4
composer require --dev orm-fixtures

Example 3: doctrine fixture bundle

// Symfony 3
composer require --dev doctrine/doctrine-fixtures-bundle

Example 4: doctrine fixture bundle

// Symfony 3
composer require --dev doctrine/doctrine-fixtures-bundle

//then register the bundle in app/AppKernel.php

// registerBundles()
if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
    // ...
    $bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle();
}

Tags:

Misc Example