From 70829f235b3efcf28e220ea9e696776f961339a4 Mon Sep 17 00:00:00 2001 From: Danny van Wijk Date: Mon, 2 Dec 2024 09:42:25 +0100 Subject: [PATCH] Fix compatibility with doctrine fixtures 2.0 --- .../ORM/LegalGenerator/DefaultFixtures.php | 4 +--- src/Kunstmaan/FixturesBundle/README.md | 18 ++++++++---------- .../DataFixtures/ORM/GroupFixtures.php | 4 +--- .../DataFixtures/ORM/RoleFixtures.php | 4 +--- .../DataFixtures/ORM/UserFixtures.php | 4 +--- .../DefaultSiteFixtures.php | 4 +--- .../ORM/SearchPageGenerator/SearchFixtures.php | 4 +--- .../DataFixtures/ORM/FolderFixtures.php | 4 +--- .../DataFixtures/ORM/TranslationFixtures.php | 4 +--- 9 files changed, 16 insertions(+), 34 deletions(-) diff --git a/src/Kunstmaan/CookieBundle/Resources/skeleton/legal/DataFixtures/ORM/LegalGenerator/DefaultFixtures.php b/src/Kunstmaan/CookieBundle/Resources/skeleton/legal/DataFixtures/ORM/LegalGenerator/DefaultFixtures.php index 5a1c715668..68c7bcf719 100644 --- a/src/Kunstmaan/CookieBundle/Resources/skeleton/legal/DataFixtures/ORM/LegalGenerator/DefaultFixtures.php +++ b/src/Kunstmaan/CookieBundle/Resources/skeleton/legal/DataFixtures/ORM/LegalGenerator/DefaultFixtures.php @@ -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; } diff --git a/src/Kunstmaan/FixturesBundle/README.md b/src/Kunstmaan/FixturesBundle/README.md index e0b0f5c212..c58e4b5c94 100644 --- a/src/Kunstmaan/FixturesBundle/README.md +++ b/src/Kunstmaan/FixturesBundle/README.md @@ -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 @@ -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; } @@ -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 @@ -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 @@ -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``` 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``` diff --git a/src/Kunstmaan/GeneratorBundle/DataFixtures/ORM/GroupFixtures.php b/src/Kunstmaan/GeneratorBundle/DataFixtures/ORM/GroupFixtures.php index 9669544aa5..c024de64e0 100644 --- a/src/Kunstmaan/GeneratorBundle/DataFixtures/ORM/GroupFixtures.php +++ b/src/Kunstmaan/GeneratorBundle/DataFixtures/ORM/GroupFixtures.php @@ -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; } diff --git a/src/Kunstmaan/GeneratorBundle/DataFixtures/ORM/RoleFixtures.php b/src/Kunstmaan/GeneratorBundle/DataFixtures/ORM/RoleFixtures.php index 407ae45e16..f9edf4057c 100644 --- a/src/Kunstmaan/GeneratorBundle/DataFixtures/ORM/RoleFixtures.php +++ b/src/Kunstmaan/GeneratorBundle/DataFixtures/ORM/RoleFixtures.php @@ -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; } diff --git a/src/Kunstmaan/GeneratorBundle/DataFixtures/ORM/UserFixtures.php b/src/Kunstmaan/GeneratorBundle/DataFixtures/ORM/UserFixtures.php index d2f3f240c1..a8ad957418 100644 --- a/src/Kunstmaan/GeneratorBundle/DataFixtures/ORM/UserFixtures.php +++ b/src/Kunstmaan/GeneratorBundle/DataFixtures/ORM/UserFixtures.php @@ -103,10 +103,8 @@ private function createUser( /** * Get the order of this fixture - * - * @return int */ - public function getOrder() + public function getOrder(): int { return 3; } diff --git a/src/Kunstmaan/GeneratorBundle/Resources/SensioGeneratorBundle/skeleton/defaultsite/DataFixtures/ORM/DefaultSiteGenerator/DefaultSiteFixtures.php b/src/Kunstmaan/GeneratorBundle/Resources/SensioGeneratorBundle/skeleton/defaultsite/DataFixtures/ORM/DefaultSiteGenerator/DefaultSiteFixtures.php index c8cd69a558..5c0bf9ad34 100755 --- a/src/Kunstmaan/GeneratorBundle/Resources/SensioGeneratorBundle/skeleton/defaultsite/DataFixtures/ORM/DefaultSiteGenerator/DefaultSiteFixtures.php +++ b/src/Kunstmaan/GeneratorBundle/Resources/SensioGeneratorBundle/skeleton/defaultsite/DataFixtures/ORM/DefaultSiteGenerator/DefaultSiteFixtures.php @@ -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; } diff --git a/src/Kunstmaan/GeneratorBundle/Resources/SensioGeneratorBundle/skeleton/searchpage/DataFixtures/ORM/SearchPageGenerator/SearchFixtures.php b/src/Kunstmaan/GeneratorBundle/Resources/SensioGeneratorBundle/skeleton/searchpage/DataFixtures/ORM/SearchPageGenerator/SearchFixtures.php index f734a97c90..cfaf07a9ee 100644 --- a/src/Kunstmaan/GeneratorBundle/Resources/SensioGeneratorBundle/skeleton/searchpage/DataFixtures/ORM/SearchPageGenerator/SearchFixtures.php +++ b/src/Kunstmaan/GeneratorBundle/Resources/SensioGeneratorBundle/skeleton/searchpage/DataFixtures/ORM/SearchPageGenerator/SearchFixtures.php @@ -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; } diff --git a/src/Kunstmaan/MediaBundle/DataFixtures/ORM/FolderFixtures.php b/src/Kunstmaan/MediaBundle/DataFixtures/ORM/FolderFixtures.php index bdcc07e20a..acb5e837cf 100644 --- a/src/Kunstmaan/MediaBundle/DataFixtures/ORM/FolderFixtures.php +++ b/src/Kunstmaan/MediaBundle/DataFixtures/ORM/FolderFixtures.php @@ -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; } diff --git a/src/Kunstmaan/TranslatorBundle/DataFixtures/ORM/TranslationFixtures.php b/src/Kunstmaan/TranslatorBundle/DataFixtures/ORM/TranslationFixtures.php index a3177cb662..5c6121dcc9 100644 --- a/src/Kunstmaan/TranslatorBundle/DataFixtures/ORM/TranslationFixtures.php +++ b/src/Kunstmaan/TranslatorBundle/DataFixtures/ORM/TranslationFixtures.php @@ -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; }