-
Notifications
You must be signed in to change notification settings - Fork 45
/
LoadDependentUserData.php
54 lines (45 loc) · 1.24 KB
/
LoadDependentUserData.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
declare(strict_types=1);
/*
* This file is part of the Liip/TestFixturesBundle
*
* (c) Lukas Kahwe Smith <smith@pooteeweet.org>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Liip\Acme\Tests\App\DataFixtures\ORM;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use Liip\Acme\Tests\App\Entity\User;
class LoadDependentUserData extends AbstractFixture implements DependentFixtureInterface
{
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager): void
{
$user = new User();
$user->setId(3);
$user->setName('alice bar');
$user->setEmail('alice@bar.com');
$manager->persist($user);
$manager->flush();
$user = new User();
$user->setId(4);
$user->setName('eve bar');
$user->setEmail('eve@bar.com');
$manager->persist($user);
$manager->flush();
}
/**
* {@inheritdoc}
*/
public function getDependencies(): array
{
return [
'Liip\Acme\Tests\App\DataFixtures\ORM\LoadUserData',
];
}
}