Conditions | 1 |
Paths | 1 |
Total Lines | 28 |
Code Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
28 | public function init(): void |
||
29 | { |
||
30 | $now = new DateTime(); |
||
31 | $then = new DateTime('1970-01-01 00:00:00'); |
||
32 | |||
33 | // Anonymous |
||
34 | $user = (new User())->setId(UsersConstant::USER_ID_ANONYMOUS); |
||
35 | $user->setUsername('guest'); |
||
36 | $user->setEmail(''); |
||
37 | $user->setActivated(UsersConstant::ACTIVATED_ACTIVE) |
||
38 | ->setApprovedDate($then) |
||
39 | ->setApprovedBy(UsersConstant::USER_ID_ADMIN) |
||
40 | ->setRegistrationDate($then) |
||
41 | ->setLastLogin($then); |
||
42 | $this->entityManager->persist($user); |
||
43 | |||
44 | // Admin |
||
45 | $user = (new User())->setId(UsersConstant::USER_ID_ADMIN); |
||
46 | $user->setUsername('admin'); |
||
47 | $user->setEmail(''); |
||
48 | $user->setActivated(UsersConstant::ACTIVATED_ACTIVE) |
||
49 | ->setApprovedDate($now) |
||
50 | ->setApprovedBy(UsersConstant::USER_ID_ADMIN) |
||
51 | ->setRegistrationDate($now) |
||
52 | ->setLastLogin($then); |
||
53 | $this->entityManager->persist($user); |
||
54 | |||
55 | $this->entityManager->flush(); |
||
56 | } |
||
58 |