Coder Social home page Coder Social logo

diegograssato / doctrine-odm-datafixture Goto Github PK

View Code? Open in Web Editor NEW
3.0 5.0 2.0 24 KB

Module to generate fixture with Doctrine ODM

License: MIT License

PHP 100.00%
doctrine-odm odm doctrine2 groups mongodb fixtures datafixture doctrinemongoodmdatafixture

doctrine-odm-datafixture's Introduction

DoctrineMongoODMDatafixture

Module to generate fixture with Doctrine ODM

Instalation

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

    "diegograssato/doctrine-odm-datafixture": "2.0"

Next step is to update the composer

  composer self-update
  composer 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_fixtures' => [
     __DIR__.'/../src/Fixtures',
  ]

or group configurator

    'odm_fixtures' => [
        'groups' => [
            'default' => [
                __DIR__.'/../MyModule/src/MyModule/Fixtures/default',
            ],
            'production' => [
                 __DIR__.'/../MyModule/src/MyModule/Fixtures/production',
            ]
        ]
    ]

To rotate the fixture use the terminal command:

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

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

  vendor/bin/doctrine-module odm:fixtures:load

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

  vendor/bin/doctrine-module odm:fixtures:load --fixture=/path/to/fixtures1 --fixture=/path/to/fixtures2

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

  vendor/bin/doctrine-module odm:fixture:load --fixture=/path/to/fixtures1 --fixture=/path/to/fixtures2 --append

You can also optionally specify the group configuration:

  vendor/bin/doctrine-module odm:fixtures:load --group production

You can also optionally list the fixtures:

  vendor/bin/doctrine-module odm:fixtures:list --group production

Finish!

doctrine-odm-datafixture's People

Contributors

diegograssato avatar grassato avatar jeanfinck avatar juizmill avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

diegomow juizmill

doctrine-odm-datafixture's Issues

Add group support configuration

On module.config.php configuration file:

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

On run datafixure to production and stage:

php public/index.php odm:fixture:load -g production
php public/index.php odm:fixture:load -g stage

On run datafixure to default:

php public/index.php odm:fixture:load

or

php public/index.php odm:fixture:load -g default

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.