Skip to content

Vowow/AliceBundle

 
 

Repository files navigation

AliceBundle

A Symfony bundle to manage fixtures with nelmio/alice and fzaninotto/Faker.

Package version Build Status SensioLabsInsight Dependency Status Scrutinizer Code Quality Code Coverage

Documentation

  1. Install
  2. Basic usage
  3. Advanced usage
  4. Custom Faker Providers
  5. Custom Alice Processors
  6. DoctrineFixturesBundle support
  7. Resources

Other references:

Installation

You can use Composer to install the bundle to your project:

composer require hautelook/alice-bundle

Then, enable the bundle by updating your app/config/AppKernel.php file to enable the bundle:

<?php
// app/config/AppKernel.php

public function registerBundles()
{
    //...
    if (in_array($this->getEnvironment(), array('dev', 'test'))) {
        //...
        $bundles[] = new Hautelook\AliceBundle\HautelookAliceBundle();
    }

    return $bundles;
}

Configure the bundle to your needs:

# app/config/config.yml

hautelook_alice:
    locale: en_US       # Locale to used for faker; must be a valid Faker locale otherwise will fallback to en_EN
    seed: 1             # A seed to make sure faker generates data consistently across runs, set to null to disable
    persist_once: false # Only persist objects once if multiple files are passed

Fore more information regarding the locale, refer to Faker documentation on localization.

Basic usage

Assuming you are using Doctrine, install the doctrine/doctrine-bundle and doctrine/data-fixtures packages and register both bundles. Then create a fixture file in AppBundle/DataFixtures/ORM:

# AppBundle/DataFixtures/ORM/dummy.yml

AppBundle\Entity\Dummy:
    dummy_{1..10}:
        name: <name()>

Then simply load your fixtures with the doctrine command php app/console hautelook_alice:fixtures:load (or php app/console h:f:l).

If you want to load the fixtures of a bundle only, do php app/console h:f:l -b MyFirstBundle -b MySecondBundle.

See more.
Next chapter: Advanced usage

Resources

Credits

This bundle is developped by Baldur Rensch, HauteLook and its awesome contributors.

License

license

About

A Symfony bundle to manage fixtures with Alice and Faker.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%