chamilo/chamilo-lms

View on GitHub
src/CoreBundle/DataFixtures/ResourceFormatFixtures.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

declare(strict_types=1);

/* For licensing terms, see /license.txt */

namespace Chamilo\CoreBundle\DataFixtures;

use Chamilo\CoreBundle\Entity\ResourceFormat;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Persistence\ObjectManager;

class ResourceFormatFixtures extends Fixture
{
    public function load(ObjectManager $manager): void
    {
        $list = [
            [
                'name' => 'html',
            ],
            [
                'name' => 'txt',
            ],
        ];

        foreach ($list as $key => $data) {
            $resourceFormat = (new ResourceFormat())
                ->setTitle($data['name'])
            ;
            $manager->persist($resourceFormat);
        }

        $manager->flush();
    }
}