add support for yml file fixtures with nelmio/alice #64

Open
dbu opened this Issue Nov 1, 2012 · 5 comments

4 participants

@dbu
Doctrine member
dbu commented Nov 1, 2012

would be cool to support alice (and with it, faker) so that we can just load fixtures from simple files instead of writing code. see https://github.com/nelmio/alice

i can do a PR, but wanted to ask first

  • should i extend doctrine:fixtures:load to support both? or do we rather do a new command, and what should that command be named?
  • i propose to make alice an optional dependency and only load the service if alice is available.

right now i do a pseudo-fixture class that just uses alice.

use Nelmio\Alice\Fixtures;
class LoadPersonData implements FixtureInterface
{

    public function load(ObjectManager $manager)
    {
        Fixtures::load(__DIR__.'/data/person.yml', $manager);
        $manager->flush();
    }
}
@kbsali

👍

@dbu
Doctrine member

oh, very cool! i created hautelook/AliceBundle#72

can you do a pull request on the symfony-docs page http://symfony.com/doc/current/bundles/DoctrineFixturesBundle/index.html to explain that for generated data, faker/alice + AliceBundle is a thing to look at?

@theofidry

That would be cool but it's not the docs of symfony-docs but of the bundle DoctrineFixturesBundle instead so not sure it's doable.

@dbu
Doctrine member

ah yes, that PR would need to go against this repository instead: https://github.com/doctrine/DoctrineFixturesBundle/blob/master/Resources/doc/index.rst

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment