fzaninotto/Faker — pull request #46 by ruimarinho (2012-06-27 10:49:12+00:00)
Title: Added support for partial execution and multiple runs

1. This change prevents multiple calls to `execute()` triggering re-insertion of entities already persisted. For each run, it now clears the managed entities.

2. Multiple `execute()` calls are particularly useful when one needs partial results to populate the next entity data. This paved the way to support partial executions by passing the entity class name:

```php

```php
addEntity('Author', 5);
$insertedPKs = $populator->execute(null, 'Author');

$authors = $insertedPKs['Author'];
$populator->addEntity('Book', 10, array(
'author' => function() use ($generator, $authors) { return $generator->randomElement($authors); },
));
$insertedPKs = $populator->execute();
```