diegograssato / doctrine-odm-datafixture

Module to generate fixture with Doctrine ODM


DoctrineMongoODMDatafixture

Module to generate fixture with Doctrine ODM

Installation

To install is quite simple, add the composer.json:

    "diegograssato/doctrine-odm-datafixture": "1.*"

Next step is to update the composer

  php composer.phar self-update
  php composer.phar install

Then add DoctrineMongoODMDatafixture to your config/application.config.php.

In module.config.php you should inform the folder where your fixtures, for example:

  'odm-data-fixtures' => [
      __NAMESPACE__.'_fixtures' => __DIR__.'/../src/Fixtures',
  ]

or group configurator

'odm-data-fixtures' => [
    'groups' => [
        'default' => [
            __NAMESPACE__.'_fixtures' => __DIR__.'/../src/Fixtures/default',
        ],
        'production' => [
            __NAMESPACE__.'_fixtures' => __DIR__.'/../src/Fixtures/prod',
        ]
    ]
]

To rotate the fixture use the terminal command:

  vendor/bin/doctrine-odm-datafixture odm:fixture:load

The odm:fixture:load command loads data fixtures from your bundles:

  php public/index.php odm:fixture:load

You can also optionally specify the path to fixtures with the --fixtures option:

  php public/index.php odm:fixture:load --fixtures=/path/to/fixtures1 --fixtures=/path/to/fixtures2

If you want to append the fixtures instead of flushing the database first you can use the --append option:

  php public/index.php odm:fixture:load --fixtures=/path/to/fixtures1 --fixtures=/path/to/fixtures2 --append

You can also optionally specify the group configuration:

  php public/index.php odm:fixture:load --group production

Finish!

No license file found for this Module
php composer.phar require "diegograssato/doctrine-odm-datafixture"

Require

  • php: ^5.6 || ^7.0
  • doctrine/doctrine-mongo-odm-module: ^0.11.0
  • doctrine/data-fixtures: dev-master
  • zendframework/zend-mvc: ^2.7.10 || ^3.0.1
  • zendframework/zend-servicemanager: ^2.7.6 || ^3.1
  • zendframework/zend-stdlib: ^2.7.7 || ^3.0.1

Require Dev

  • phpunit/phpunit: ^4.8
  • squizlabs/php_codesniffer: ^2.6.2