<commit_before># Blueprint Bundle

The bundle provides a way to manage test data for the Doctrine ORM.

## Usage

src/Acme/BlogBundle/Tests/Blueprints/post.php:

```php
namespace Acme\BlogBundle\Tests\Blueprints;

use Dakatsuka\BlueprintBundle\Blueprint;

Blueprint::register('post', 'Acme\BlogBundle\Entity\Post', function($post, $blueprint) {
    $post->setTitle('Title'.$blueprint->sequence());
    $post->setBody('BodyBodyBody');
});
```

src/Acme/BlogBundle/Tests/Blueprints/comment.php:
```php
namespace Acme\BlogBundle\Tests\Blueprints;

use Dakatsuka\BlueprintBundle\Blueprint;

Blueprint::register('comment', 'Acme\BlogBundle\Entity\Comment', function($comment, $blueprint) {
    $comment->setPost($blueprint->create('post'));
    $comment->setBody('CommentCommentComment');
});
```

How to use:
```php
static::$kernel = static::createKernel();
static::$kernel->boot();
static::$container = static::$kernel->getContainer();

$blueprint = static::$container->get('dakatsuka.blueprint');
$blueprint->loadFromDirectory(static::$kernel->getRootDir() . '/../src/Acme/BlogBundle/Tests/Blueprints');

$post = $blueprint->create('post');
$post->getTitle(); // 'Title1'
$post->getBody();  // 'BodyBodyBody'

$comment = $blueprint->create('comment');
$comment->getBody();              // 'CommentCommentComment'
$comment->getPost()->getTitle();  // 'Title2'

// optional
$comment2 = $blueprint->create('comment', array('post' => $post));
$comment2->getPost()->getTitle(); // Title1
```

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

## Copyright

Copyright (C) 2013 D<NAME>, released under the MIT License.
<commit_msg>Described how to install bundle<commit_after># Blueprint Bundle

The bundle provides a way to manage test data for the Doctrine ORM.

## Installation

Add this lines to your composer.json:

```
{
    "require": {
        "dakatsuka/blueprint-bundle": "dev-master"
    }
}
```

And then execute:

```
$ php composer.phar install
```

And import a BlueprintBundle to AppKernel.php:

```php
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
    // snip //

    $bundles[] = new Dakatsuka\BlueprintBundle\DakatsukaBlueprintBundle();
}
```


## Usage

src/Acme/BlogBundle/Tests/Blueprints/post.php:

```php
namespace Acme\BlogBundle\Tests\Blueprints;

use Dakatsuka\BlueprintBundle\Blueprint;

Blueprint::register('post', 'Acme\BlogBundle\Entity\Post', function($post, $blueprint) {
    $post->setTitle('Title'.$blueprint->sequence());
    $post->setBody('BodyBodyBody');
});
```

src/Acme/BlogBundle/Tests/Blueprints/comment.php:
```php
namespace Acme\BlogBundle\Tests\Blueprints;

use Dakatsuka\BlueprintBundle\Blueprint;

Blueprint::register('comment', 'Acme\BlogBundle\Entity\Comment', function($comment, $blueprint) {
    $comment->setPost($blueprint->create('post'));
    $comment->setBody('CommentCommentComment');
});
```

How to use:
```php
static::$kernel = static::createKernel();
static::$kernel->boot();
static::$container = static::$kernel->getContainer();

$blueprint = static::$container->get('dakatsuka.blueprint');
$blueprint->loadFromDirectory(static::$kernel->getRootDir() . '/../src/Acme/BlogBundle/Tests/Blueprints');

$post = $blueprint->create('post');
$post->getTitle(); // 'Title1'
$post->getBody();  // 'BodyBodyBody'

$comment = $blueprint->create('comment');
$comment->getBody();              // 'CommentCommentComment'
$comment->getPost()->getTitle();  // 'Title2'

// optional
$comment2 = $blueprint->create('comment', array('post' => $post));
$comment2->getPost()->getTitle(); // Title1
```

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

## Copyright

Copyright (C) 2013 <NAME>, released under the MIT License.

{'fraction_non_alphanumeric': 0.18397040690505548, 'fraction_numerical': 0.0069050554870530205, 'mean_word_length': 5.201834862385321, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 50, 'https://': 0, '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': '7498069', 'n_tokens_mistral': 1335, 'n_tokens_neox': 1284, 'n_words': 275}