@@ -14,8 +14,6 @@ This is installable via [Composer](https://getcomposer.org/) as [sp/fixture-dump
14
14
15
15
### Basic Usage ###
16
16
17
- Examples:
18
-
19
17
``` php
20
18
$manager = ...; // entity or document manager
21
19
$registry = new \Sp\FixtureDumper\Converter\Handler\HandlerRegistry();
@@ -30,16 +28,31 @@ $ymlGenerator = new \Sp\FixtureDumper\Generator\Alice\YamlFixtureGenerator();
30
28
// for creating array files which can be loaded with the alice fixtures library
31
29
$arrayGenerator = new \Sp\FixtureDumper\Generator\Alice\ArrayFixtureGenerator();
32
30
33
- $generatorMap = new \PhpCollection\Map(array('class' => $generator, 'yml' => $ymlGenerator, 'array' => $arrayGenerator);
34
- $dumper = new \Sp\FixtureDumper\ORMDumper($manager, $registry, $generatorMap)) ;
31
+ $generatorMap = new \PhpCollection\Map(array('class' => $generator, 'yml' => $ymlGenerator, 'array' => $arrayGenerator)) ;
32
+ $dumper = new \Sp\FixtureDumper\ORMDumper($manager, $registry, $generatorMap);
35
33
// or
36
- $dumper = new \Sp\FixtureDumper\MongoDBDumper($manager, $registry, $generatorMap)) ;
34
+ $dumper = new \Sp\FixtureDumper\MongoDBDumper($manager, $registry, $generatorMap);
37
35
// $dumper->setDumpMultipleFiles(false);
38
36
39
37
// the second argument specifies the generator type you want to use
40
38
$dumper->dump('/your/workspace/src/Acme/DemoBundle/DataFixtures/ORM', 'array');
41
39
```
42
40
41
+ ### Exclusion Strategy ###
42
+
43
+ You can implement the interface ` ExclusionStrategyInterface ` to define the strategy to select the entities to dump.
44
+
45
+ ``` php
46
+ // ...
47
+ $dumper = new \Sp\FixtureDumper\ORMDumper($manager, $registry, $generatorMap);
48
+
49
+ // The entity Post and Comment won't be dumped
50
+ $exclusion = new ArrayExclusionStrategy(['Post', 'Acme\DemoBundle\Entity\Comment']);
51
+ $dumper->setExclusionStrategy($exclusion);
52
+
53
+ $dumper->dump(...);
54
+ ```
55
+
43
56
#### Options
44
57
45
58
` AbstractDumper#dump ` accepts a third ` $options ` argument that is an array
0 commit comments