Conditions | 2 |
Paths | 2 |
Total Lines | 16 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
27 | public function load(ObjectManager $manager): void |
||
28 | { |
||
29 | $data = [ |
||
30 | 'shakespeare' => 'William Shakespeare', |
||
31 | 'christie' => 'Agatha Christie', |
||
32 | ]; |
||
33 | |||
34 | foreach ($data as $alias => $fullName) { |
||
35 | $author = new Author($this->idGenerator->authorId(), $fullName); |
||
36 | |||
37 | $this->addReference('author-' . $alias, $author); |
||
38 | |||
39 | $manager->persist($author); |
||
40 | } |
||
41 | |||
42 | $manager->flush(); |
||
43 | } |
||
45 |