1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the TheAlternativeZurich/events project. |
5
|
|
|
* |
6
|
|
|
* (c) Florian Moser <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace App\DataFixtures; |
13
|
|
|
|
14
|
|
|
use App\Entity\User; |
15
|
|
|
use Doctrine\Bundle\FixturesBundle\Fixture; |
16
|
|
|
use Doctrine\Common\DataFixtures\OrderedFixtureInterface; |
17
|
|
|
use Doctrine\Persistence\ObjectManager; |
18
|
|
|
|
19
|
|
|
class UserFixtures extends Fixture implements OrderedFixtureInterface |
20
|
|
|
{ |
21
|
|
|
const ORDER = 0; |
22
|
|
|
const TESTER_REFERENCE = User::class.'_tester'; |
23
|
|
|
|
24
|
|
|
public function load(ObjectManager $manager) |
25
|
|
|
{ |
26
|
|
|
$entries = [ |
27
|
|
|
['[email protected]', 'asdf', 'Florian', 'Moser', '0781234567', 'Jäherweg 2', 8003, 'Zürich', 'Zürich', 'CH'], |
28
|
|
|
]; |
29
|
|
|
|
30
|
|
|
foreach ($entries as $entry) { |
31
|
|
|
$user = new User(); |
32
|
|
|
$user->setEmail($entry[0]); |
33
|
|
|
$user->setGivenName($entry[2]); |
34
|
|
|
$user->setFamilyName($entry[3]); |
35
|
|
|
$user->setPhone($entry[4]); |
36
|
|
|
|
37
|
|
|
$user->setStreetAddress($entry[5]); |
38
|
|
|
$user->setPostalCode($entry[6]); |
39
|
|
|
$user->setLocality($entry[7]); |
40
|
|
|
$user->setCanton($entry[8]); |
41
|
|
|
$user->setCountry($entry[9]); |
42
|
|
|
$manager->persist($user); |
43
|
|
|
|
44
|
|
|
$this->addReference(self::TESTER_REFERENCE, $user); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
$manager->flush(); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
public function getOrder() |
51
|
|
|
{ |
52
|
|
|
return self::ORDER; |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
|