Giter Site home page Giter Site logo

fixture-dumper's Introduction

Fixture Dumper Extension for Doctrine

This library aims to provide a simple way to dump fixtures for the Doctrine ORM/ODM.

Note: This library is still in an early stage.

Build Status

Installation

This is installable via Composer as sp/fixture-dumper.

Usage

Basic Usage

Examples:

$manager = ...; // entity or document manager
$registry = new \Sp\FixtureDumper\Converter\Handler\HandlerRegistry();
$registry->addSubscribingHandler(new \Sp\FixtureDumper\Converter\Handler\DateHandler());

// for creating fixtures classes
$generator = new \Sp\FixtureDumper\Generator\ClassFixtureGenerator($manager);

// for creating yml files which can be loaded with the alice fixtures library
$ymlGenerator = new \Sp\FixtureDumper\Generator\Alice\YamlFixtureGenerator($manager);

// for creating array files which can be loaded with the alice fixtures library
$arrayGenerator = new \Sp\FixtureDumper\Generator\Alice\ArrayFixtureGenerator($manager);

$generatorMap = new \PhpCollection\Map(array('php' => $generator, 'yml' => $ymlGenerator, 'array' => $arrayGenerator);
$dumper = new \Sp\FixtureDumper\ORMDumper($manager, $registry, $generatorMap));
// or
$dumper = new \Sp\FixtureDumper\MongoDBDumper($manager, $registry, $generatorMap));
// $dumper->setDumpMultipleFiles(false);

// the second argument specifies the generator type you want to use
$dumper->dump('/your/workspace/src/Acme/DemoBundle/DataFixtures/ORM', 'array');

Options

AbstractDumper#dump accepts a third $options argument that is an array with the following keys:

  • namespace: The namespace for the generated class to use This options is only required when using the ClassFixtureGenerator

License

Released under the MIT License, see LICENSE.

fixture-dumper's People

Contributors

spea avatar

Watchers

 avatar  avatar

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.