Completed
Pull Request — master (#21)
by Valentyn
01:42
created

GenresFixtures::load()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 8
nc 1
nop 1
1
<?php
2
3
namespace App\DataFixtures;
4
5
use App\Entity\Genre;
6
use App\Entity\Translations\GenreTranslations;
7
use Doctrine\Bundle\FixturesBundle\Fixture;
8
use Doctrine\Common\Persistence\ObjectManager;
9
10
class GenresFixtures extends Fixture
11
{
12
13
    public function load(ObjectManager $manager): void
14
    {
15
        $comedy = new Genre();
16
        $comedy
17
            ->addTranslation(new GenreTranslations($comedy, 'en', 'Comedy'))
18
            ->addTranslation(new GenreTranslations($comedy, 'uk', 'Комедія'))
19
            ->addTranslation(new GenreTranslations($comedy, 'ru', 'Комедия'));
20
21
        $manager->persist($comedy);
22
        $manager->flush();
23
    }
24
25
}