2017 © Pedro PelĂĄez
 

library alice-data-fixtures

Nelmio alice extension to persist the loaded fixtures.

image

theofidry/alice-data-fixtures

Nelmio alice extension to persist the loaded fixtures.

  • Tuesday, February 27, 2018
  • by theofidry
  • Repository
  • 4 Watchers
  • 80 Stars
  • 401,873 Installations
  • PHP
  • 9 Dependents
  • 2 Suggesters
  • 25 Forks
  • 8 Open issues
  • 15 Versions
  • 32 % Grown

The README.md

AliceDataFixtures

Alice 3.x no longer ships with a persistence layer, so this library provides one!, (*1)

Package version Build Status Slack license, (*2)

Supports:, (*3)

  • Symfony 6.4+
  • Doctrine ORM 2.20+
  • Doctrine ODM 2.0+
  • Doctrine PHPCR 2.0+
  • Eloquent 11.0+

Documentation

  1. Installation
    1. Without Symfony
    2. Symfony with Flex
    3. Symfony without flex
      1. Doctrine ORM
      2. Doctrine ODM
      3. Doctrine PHPCR
      4. Eloquent ORM
      5. Configuration
  2. Basic usage
  3. Configuration
  4. Advanced usage
    1. Processors
    2. Exclude tables from purge
    3. Usage in tests
      1. PHPUnit
      2. Behat
  5. Contributing

Configuration

The full configuration reference is:, (*4)

# app/config/config.yml

# Default config
fidry_alice_data_fixtures:
    default_purge_mode: ~ # default is "delete" but you can change it to "truncate" or "no_purge"
    db_drivers:
        doctrine_orm: ~
        doctrine_mongodb_odm: ~
        doctrine_phpcr_odm: ~
        eloquent_orm: ~

For each driver, if the appropriate bundle is detected, e.g. DoctrineORMBundle for Doctrine and WouterJEloquentBundle for Eloquent, the services related to those driver will be enabled. If you want to skip those checks you can turn a specific driver to true instead. If you want to disable a specific driver, simply force the value false instead., (*5)

Basic usage

Create a fixture file in src/AppBundle/Resources/fixtures:, (*6)

# src/AppBundle/Resources/fixtures/dummy.yml

AppBundle\Entity\Dummy:
    dummy_{1..10}:
        name: <name()>
        related_dummy: '@related_dummy*'
# src/AppBundle/Resources/fixtures/related_dummy.yml

AppBundle\Entity\RelatedDummy:
    related_dummy_{1..10}:
        name: <name()>

Then you can load those files using a LoaderInterface:, (*7)

<?php

$files = [
    'path/to/src/AppBundle/Resources/fixtures/dummy.yml',
    'path/to/src/AppBundle/Resources/fixtures/related_dummy.yml',
];

// Choose your loader
$loader = $container->get('fidry_alice_data_fixtures.loader.doctrine');         // For Doctrine ORM
$loader = $container->get('fidry_alice_data_fixtures.loader.doctrine_mongodb'); // For Doctrine MongoDB ODM
$loader = $container->get('fidry_alice_data_fixtures.loader.doctrine_phpcr');   // For Doctrine PHPCR
$loader = $container->get('fidry_alice_data_fixtures.loader.eloquent');         // For Eloquent ORM

// Purge the objects, create PHP objects from the fixture files and persist them
$objects = $loader->load($files);

// $objects is now an array of persisted `Dummy` and `RelatedDummy`

Warning: loading the objects does not trigger a clear(). This means if you are relying on some Doctrine life-cycle events in your tests, some may not be triggered as expected. See #84 For more information., (*8)

Advanced Usage

Check the advance usage entry., (*9)

Contributing

Clone the project, (*10)

To launch Docker containers for databases, run make start_databases, (*11)

Run tests with make test., (*12)

To stop containers for databases, run make stop_databases, (*13)

The Versions

27/02 2018

dev-master

9999999-dev

Nelmio alice extension to persist the loaded fixtures.

  Sources   Download

MIT

The Requires

 

The Development Requires

orm tests faker data alice fixture

21/12 2017

v1.0.1

1.0.1.0

Nelmio alice extension to persist the loaded fixtures.

  Sources   Download

MIT

The Requires

 

The Development Requires

orm tests faker data alice fixture

17/12 2017

v1.0.0

1.0.0.0

Nelmio alice extension to persist the loaded fixtures.

  Sources   Download

MIT

The Requires

 

The Development Requires

orm tests faker data alice fixture

25/11 2017

v1.0.0-rc.2

1.0.0.0-RC2

Nelmio alice extension to persist the loaded fixtures.

  Sources   Download

MIT

The Requires

 

The Development Requires

orm tests faker data alice fixture

04/11 2017

dev-bugfix/allow-sf4

dev-bugfix/allow-sf4

Nelmio alice extension to persist the loaded fixtures.

  Sources   Download

MIT

The Requires

 

The Development Requires

orm tests faker data alice fixture

03/11 2017

v1.0.0-rc.1

1.0.0.0-RC1

Nelmio alice extension to persist the loaded fixtures.

  Sources   Download

MIT

The Requires

 

The Development Requires

orm tests faker data alice fixture

29/10 2017

v1.0.0-rc.0

1.0.0.0-RC0

Nelmio alice extension to persist the loaded fixtures.

  Sources   Download

MIT

The Requires

 

The Development Requires

orm tests faker data alice fixture

29/10 2017

dev-propel2

dev-propel2

Nelmio alice extension to persist the loaded fixtures.

  Sources   Download

MIT

The Requires

 

The Development Requires

orm tests faker data alice fixture

29/06 2017

v1.0.0-beta.5

1.0.0.0-beta5

Nelmio alice extension to persist the loaded fixtures.

  Sources   Download

MIT

The Requires

 

The Development Requires

orm tests faker data alice fixture

24/05 2017

dev-refactor/loader-interface

dev-refactor/loader-interface

Nelmio alice extension to persist the loaded fixtures.

  Sources   Download

MIT

The Requires

 

The Development Requires

orm tests faker data alice fixture

17/12 2016

v1.0.0-beta.4

1.0.0.0-beta4

Nelmio alice extension to persist the loaded fixtures.

  Sources   Download

MIT

The Requires

 

The Development Requires

orm tests faker data alice fixture

06/11 2016

v1.0.0-beta.3

1.0.0.0-beta3

Nelmio alice extension to persist the loaded fixtures.

  Sources   Download

MIT

The Requires

 

The Development Requires

orm tests faker data alice fixture

02/10 2016

v1.0.0-beta.2

1.0.0.0-beta2

Nelmio alice extension to persist the loaded fixtures

  Sources   Download

MIT

The Requires

 

The Development Requires

orm tests faker data alice fixture

24/09 2016

v1.0.0-beta.1

1.0.0.0-beta1

Nelmio alice extension to persist the loaded fixtures

  Sources   Download

MIT

The Requires

 

The Development Requires

orm tests faker data alice fixture

12/09 2016

v1.0.0-beta.0

1.0.0.0-beta0

Nelmio alice extension to persist the loaded fixtures

  Sources   Download

MIT

The Requires

 

The Development Requires

orm tests faker data alice fixture