Completed
Pull Request — master (#26)
by Valentyn
02:41
created

GenresFixtures::load()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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