Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AllBundles] Fix compatibility with doctrine fixtures 2.0 #3478

Open
wants to merge 1 commit into
base: 7.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -476,10 +476,8 @@ private function createLegalPage(Node $parent, $title, $internalName, $weight)

/**
* Get the order of this fixture
*
* @return int
*/
public function getOrder()
public function getOrder(): int
{
return 52;
}
Expand Down
18 changes: 8 additions & 10 deletions src/Kunstmaan/FixturesBundle/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# How to use the FixturesBundle

You will still use the default doctrine fixtures way but instead of extending from the `Doctrine\Common\DataFixtures\AbstractFixture` class,
You will still use the default doctrine fixtures way but instead of extending from the `Doctrine\Common\DataFixtures\AbstractFixture` class,
you will instead extend from the `Kunstmaan\FixturesBundle\Loader\FixtureLoader` class.

This is what your fixture class will look like:

```php
Expand All @@ -25,10 +25,8 @@ class YamlFixtures extends FixtureLoader implements OrderedFixtureInterface

/**
* Get the order of this fixture
*
* @return integer
*/
public function getOrder()
public function getOrder(): int
{
return 50;
}
Expand Down Expand Up @@ -103,7 +101,7 @@ So how do these yaml files look like?

\Acme\SomeBundle\Entity\PageParts\ContactPagePart:
contact_pp_{1..5}:
contacts:
contacts:
- @contact_ironman
- @contact_blackwidow
- @contact_thor
Expand All @@ -115,7 +113,7 @@ So how do these yaml files look like?
fr: []

contact_pp_{6..10}:
contacts:
contacts:
- @contact_hulk
- @contact_captainamerica
- @contact_hawkeye
Expand Down Expand Up @@ -147,16 +145,16 @@ to your fixture class and returning an array containing your providers or you ca
### Parsers

Parsers are used to translate the yaml data into actual data. So something like ```@content<current()>``` will be transformed to an object by different parsers.
By default you have the Method and the Reference parser for property data and the Listed and Range parser for specs. If you want to add your
By default you have the Method and the Reference parser for property data and the Listed and Range parser for specs. If you want to add your
own parser, you can simply to that by tagging them with ```kunstmaan_fixtures.parser.property``` or ```kunstmaan_fixtures.parser.spec```

### Populators

Does exactly what the name says. Populators will populate the entities once all the yaml data is parsed. If you want to add your own populator,
Does exactly what the name says. Populators will populate the entities once all the yaml data is parsed. If you want to add your own populator,
simply tag it with ```kunstmaan_fixtures.populator```

### Builders

With builders you can manipulate the behaviour during the creation of your entity. This can happen in three stages, preBuild, postBuild and postFlushBuild.
During these stages you can manipulate your entity or add more entities like we do in the PageBuilder for instance. If you want to add your own builder,
During these stages you can manipulate your entity or add more entities like we do in the PageBuilder for instance. If you want to add your own builder,
simply tag it with ```kunstmaan_fixtures.builder```
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,8 @@ private function createGroup(ObjectManager $manager, $name, array $roles = []):

/**
* Get the order of this fixture
*
* @return int
*/
public function getOrder()
public function getOrder(): int
{
return 2;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,8 @@ private function createRole(ObjectManager $manager, $name): Role

/**
* Get the order of this fixture
*
* @return int
*/
public function getOrder()
public function getOrder(): int
{
return 1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,8 @@ private function createUser(

/**
* Get the order of this fixture
*
* @return int
*/
public function getOrder()
public function getOrder(): int
{
return 3;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -753,10 +753,8 @@ private function createVideoFile($name, $code, $folder)

/**
* Get the order of this fixture
*
* @return int
*/
public function getOrder()
public function getOrder(): int
{
return 51;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,8 @@ public function load(ObjectManager $manager): void

/**
* Get the order of this fixture
*
* @return int
*/
public function getOrder()
public function getOrder(): int
{
return 70;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,8 @@ public function load(ObjectManager $manager): void

/**
* Get the order of this fixture
*
* @return int
*/
public function getOrder()
public function getOrder(): int
{
return 1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,8 @@ public function hasFixtureInstalled($domain, $keyword, $locale)

/**
* Get the order of this fixture
*
* @return int
*/
public function getOrder()
public function getOrder(): int
{
return 1;
}
Expand Down
Loading