1 <?php
declare(strict_types
=1);
4 * This file is part of the Rapsys TreeBundle package.
6 * (c) Raphaël Gertz <symfony@rapsys.eu>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Rapsys\TreeBundle\Fixture
;
14 use Doctrine\Bundle\FixturesBundle\Fixture
;
15 use Doctrine\Persistence\ObjectManager
;
17 use Rapsys\PackBundle\Util\SluggerUtil
;
18 use Rapsys\TreeBundle\Entity\Album
;
19 use Rapsys\TreeBundle\RapsysTreeBundle
;
21 use Symfony\Component\DependencyInjection\ContainerInterface
;
26 class TreeFixture
extends Fixture
{
30 private array $config;
33 * Air fixtures constructor
35 public function __construct(private ContainerInterface
$container, private SluggerUtil
$slugger) {
37 $this->config
= $container->getParameter(RapsysTreeBundle
::getAlias());
43 public function load(ObjectManager
$manager) {
50 foreach($albumTree as $albumTitle => $albumPath) {
51 $album = new Album($albumPath, $this->slugger
->slug($albumTitle), $albumTitle);
52 $manager->persist($album);
53 $albums[$albumTitle] = $album;
57 //Flush to get the ids