]> Raphaël G. Git Repositories - treebundle/commitdiff
Add bundle fixture
authorRaphaël Gertz <git@rapsys.eu>
Thu, 31 Oct 2024 06:49:56 +0000 (07:49 +0100)
committerRaphaël Gertz <git@rapsys.eu>
Thu, 31 Oct 2024 06:49:56 +0000 (07:49 +0100)
Fixture/TreeFixture.php [new file with mode: 0644]

diff --git a/Fixture/TreeFixture.php b/Fixture/TreeFixture.php
new file mode 100644 (file)
index 0000000..8ea1b4b
--- /dev/null
@@ -0,0 +1,45 @@
+<?php declare(strict_types=1);
+
+/*
+ * This file is part of the Rapsys TreeBundle package.
+ *
+ * (c) Raphaël Gertz <symfony@rapsys.eu>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Rapsys\TreeBundle\Fixture;
+
+use Doctrine\Bundle\FixturesBundle\Fixture;
+use Doctrine\Persistence\ObjectManager;
+
+use Rapsys\TreeBundle\RapsysTreeBundle;
+
+use Symfony\Component\DependencyInjection\ContainerInterface;
+
+/**
+ * {@inheritdoc}
+ */
+class TreeFixture extends Fixture {
+       /**
+        * Config array
+        */
+       protected array $config;
+
+       /**
+        * Air fixtures constructor
+        */
+       public function __construct(protected ContainerInterface $container) {
+               //Retrieve config
+               $this->config = $container->getParameter(RapsysTreeBundle::getAlias());
+       }
+
+       /**
+        * {@inheritDoc}
+        */
+       public function load(ObjectManager $manager) {
+               //Flush to get the ids
+               $manager->flush();
+       }
+}