Completed
Push — master ( b4d909...e3c084 )
by Valentyn
03:37
created

ActorsFixtures   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 5
dl 0
loc 21
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A load() 0 10 1
1
<?php
2
3
namespace App\Actors\DataFixtures;
4
5
use App\Actors\Entity\Actor;
6
use App\Actors\Entity\ActorTMDB;
7
use App\Actors\Entity\ActorTranslations;
8
use Doctrine\Bundle\FixturesBundle\Fixture;
9
use Doctrine\Common\Persistence\ObjectManager;
10
11
class ActorsFixtures extends Fixture
12
{
13
    const ACTOR_ORIGINAL_NAME = 'Original Name';
14
    const ACTOR_TMDB_ID = 1;
15
16
    /**
17
     * @param ObjectManager $manager
18
     *
19
     * @throws \Exception
20
     */
21
    public function load(ObjectManager $manager): void
22
    {
23
        $actorTmdb = new ActorTMDB(self::ACTOR_TMDB_ID);
24
        $actor = new Actor(self::ACTOR_ORIGINAL_NAME, $actorTmdb);
25
        $actor->addTranslation(new ActorTranslations($actor, 'en', self::ACTOR_ORIGINAL_NAME));
26
        $actor->addTranslation(new ActorTranslations($actor, 'pl', 'Name'));
27
28
        $manager->persist($actor);
29
        $manager->flush();
30
    }
31
}
32