<commit_before>DavidBaduraFixturesBundle
=========================

[![Build Status](https://secure.travis-ci.org/DavidBadura/FixturesBundle.png)](http://travis-ci.org/DavidBadura/FixturesBundle)

Installation
------------

Add the DavidBaduraFixturesBundle to your application kernel:

``` php
// app/AppKernel.php
public function registerBundles()
{
    return array(
        // ...
        new DavidBadura\FixturesBundle\DavidBaduraFixturesBundle(),
        // ...
    );
}
```

Create fixture types
--------------------

Create user fixture type

``` php
// YourBundle/FixtureTypes/UserType.php
namespace YourBundle\FixtureTypes;

use DavidBadura\FixturesBundle\FixtureType\FixtureType;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;

class UserType extends FixtureType
{

    public function createObject($data)
    {
        $user = new User($data['name'], $data['email']);
        foreach ($data['groups'] as $group) {
            $user->addGroup($group);
        }

        return $user;
    }

    public function addNodeSchema(NodeBuilder $node)
    {
        $node->scalarNode('name')->isRequired()->end()
                ->scalarNode('email')->isRequired()->end()
                ->arrayNode('groups')
                ->useAttributeAsKey('key')
                ->prototype('scalar')->end()
                ->end()
        ;
    }


    public function getName()
    {
        return 'user';
    }

    public function getOrder() {
        return 2;
    }<commit_msg>update readme (remove useless useAttributeAsKey)<commit_after>DavidBaduraFixturesBundle
=========================

[![Build Status](https://secure.travis-ci.org/DavidBadura/FixturesBundle.png)](http://travis-ci.org/DavidBadura/FixturesBundle)

Installation
------------

Add the DavidBaduraFixturesBundle to your application kernel:

``` php
// app/AppKernel.php
public function registerBundles()
{
    return array(
        // ...
        new DavidBadura\FixturesBundle\DavidBaduraFixturesBundle(),
        // ...
    );
}
```

Create fixture types
--------------------

Create user fixture type

``` php
// YourBundle/FixtureTypes/UserType.php
namespace YourBundle\FixtureTypes;

use DavidBadura\FixturesBundle\FixtureType\FixtureType;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;

class UserType extends FixtureType
{

    public function createObject($data)
    {
        $user = new User($data['name'], $data['email']);
        foreach ($data['groups'] as $group) {
            $user->addGroup($group);
        }

        return $user;
    }

    public function addNodeSchema(NodeBuilder $node)
    {
        $node->scalarNode('name')->isRequired()->end()
                ->scalarNode('email')->isRequired()->end()
                ->arrayNode('groups')
                ->prototype('scalar')->end()
                ->end()
        ;
    }


    public function getName()
    {
        return 'user';
    }

    public function getOrder() {
        return 2;
    }
{'fraction_non_alphanumeric': 0.16801075268817203, 'fraction_numerical': 0.0006720430107526882, 'mean_word_length': 2.4737456242707117, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 26, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6140687', 'n_tokens_mistral': 856, 'n_tokens_neox': 818, 'n_words': 149}