All Projects → theofidry → Alicedatafixtures

theofidry / Alicedatafixtures

Licence: mit
Nelmio Alice extension to persist the loaded fixtures.

Projects that are alternatives of or similar to Alicedatafixtures

Doctrinefixturesbundle
Symfony integration for the doctrine/data-fixtures library
Stars: ✭ 2,174 (+853.51%)
Mutual labels:  symfony, symfony-bundle, fixtures
Alice
Expressive fixtures generator
Stars: ✭ 2,289 (+903.95%)
Mutual labels:  symfony, symfony-bundle, fixtures
Entityauditbundle
Audit for Doctrine Entities
Stars: ✭ 546 (+139.47%)
Mutual labels:  database, symfony, symfony-bundle
Webauthn Framework
FIDO-U2F / FIDO2 / Webauthn Framework
Stars: ✭ 182 (-20.18%)
Mutual labels:  symfony, symfony-bundle
Hwioauthbundle
OAuth client integration for Symfony. Supports both OAuth1.0a and OAuth2.
Stars: ✭ 2,150 (+842.98%)
Mutual labels:  symfony, symfony-bundle
Sonatapagebundle
This bundle provides a Site and Page management through container and block services
Stars: ✭ 181 (-20.61%)
Mutual labels:  symfony, symfony-bundle
Lexikjwtauthenticationbundle
JWT authentication for your Symfony API
Stars: ✭ 2,184 (+857.89%)
Mutual labels:  symfony, symfony-bundle
Gifexceptionbundle
😛 The GhostBuster of your exception page!
Stars: ✭ 197 (-13.6%)
Mutual labels:  symfony, symfony-bundle
Mercure Bundle
The MercureBundle allows to easily push updates to web browsers and other HTTP clients in the Symfony full-stack framework, using the Mercure protocol.
Stars: ✭ 195 (-14.47%)
Mutual labels:  symfony, symfony-bundle
Rich Model Forms Bundle
Provides additional data mappers that ease the use of the Symfony Form component with rich models.
Stars: ✭ 198 (-13.16%)
Mutual labels:  symfony, symfony-bundle
Victoire
Fullstack Symfony CMS: The perfect mix between a framework and a CMS
Stars: ✭ 227 (-0.44%)
Mutual labels:  symfony, symfony-bundle
Adminltebundle
AdminLTE bundle for Symfony 4 - an backend/admin theme for easy integration with SF4. Its based on the AdminLTE Template and built with webpack-encore. Supports KNPMenuBundle and FOSUserBundle.
Stars: ✭ 178 (-21.93%)
Mutual labels:  symfony, symfony-bundle
Monolog Bundle
Symfony Monolog Bundle
Stars: ✭ 2,532 (+1010.53%)
Mutual labels:  symfony, symfony-bundle
Sonataintlbundle
Symfony SonataIntlBundle
Stars: ✭ 212 (-7.02%)
Mutual labels:  symfony, symfony-bundle
Msgphp
Reusable domain layers. Shipped with industry standard infrastructure.
Stars: ✭ 182 (-20.18%)
Mutual labels:  symfony, symfony-bundle
Twig Bundle
The Twig Bundle provides configuration for using Twig in your applications.
Stars: ✭ 2,150 (+842.98%)
Mutual labels:  symfony, symfony-bundle
Schedule Bundle
Schedule Cron jobs (commands/callbacks/bash scripts) within your Symfony application.
Stars: ✭ 216 (-5.26%)
Mutual labels:  symfony, symfony-bundle
Nelmioapidocbundle
Generates documentation for your REST API from annotations
Stars: ✭ 2,009 (+781.14%)
Mutual labels:  symfony, symfony-bundle
Sonataadminbundle
The missing Symfony Admin Generator
Stars: ✭ 2,039 (+794.3%)
Mutual labels:  symfony, symfony-bundle
Liiphellobundle
[DEPRECATED] Alternative Hello World Bundle for Symfony2 using several FriendsOfSymfony Bundles
Stars: ✭ 206 (-9.65%)
Mutual labels:  symfony, symfony-bundle

AliceDataFixtures

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

Package version Build Status Slack license

Supports:

  • Symfony 3.4, 4.0+, 5.0+
  • Doctrine ORM 2.5+
  • Doctrine ODM 1.2+
  • Doctrine PHPCR 1.4+
  • Eloquent 5.5+
  • Propel 2

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:

# 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, is 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.

Basic usage

Create a fixture file in src/AppBundle/Resources/fixtures:

# 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:

<?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.

Advanced Usage

Check the advance usage entry.

Contributing

Clone the project

To launch Docker containers for databases, run make start_databases

Run tests with make test.

To stop containers for databases, run make stop_databases

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].