@@ 63-79 (lines=17) @@ | ||
60 | * |
|
61 | * @param ObjectManager $manager [description] |
|
62 | */ |
|
63 | private function addAdmin($manager) |
|
64 | { |
|
65 | $user = new User(); |
|
66 | ||
67 | $user->setUsername('admin'); |
|
68 | $user->setEmail('[email protected]'); |
|
69 | ||
70 | $factory = $this->container->get('security.encoder_factory'); |
|
71 | $encoder = $factory->getEncoder($user); |
|
72 | $password = $encoder->encodePassword('test', $user->getSalt()); |
|
73 | $user->setPassword($password); |
|
74 | ||
75 | $role = $manager->getRepository('Webcook\Cms\SecurityBundle\Entity\Role')->findAll(); |
|
76 | $user->addRole($role[0]); |
|
77 | ||
78 | $manager->persist($user); |
|
79 | } |
|
80 | ||
81 | /** |
|
82 | * Add editor user. |
|
@@ 86-102 (lines=17) @@ | ||
83 | * |
|
84 | * @param ObjectManager $manager [description] |
|
85 | */ |
|
86 | private function addEditor($manager) |
|
87 | { |
|
88 | $user = new User(); |
|
89 | ||
90 | $user->setUsername('editor'); |
|
91 | $user->setEmail('[email protected]'); |
|
92 | ||
93 | $factory = $this->container->get('security.encoder_factory'); |
|
94 | $encoder = $factory->getEncoder($user); |
|
95 | $password = $encoder->encodePassword('test', $user->getSalt()); |
|
96 | $user->setPassword($password); |
|
97 | ||
98 | $role = $manager->getRepository('Webcook\Cms\SecurityBundle\Entity\Role')->findAll(); |
|
99 | $user->addRole($role[1]); |
|
100 | ||
101 | $manager->persist($user); |
|
102 | } |
|
103 | ||
104 | /** |
|
105 | * Add Test user. |
|
@@ 109-125 (lines=17) @@ | ||
106 | * |
|
107 | * @param ObjectManager $manager [description] |
|
108 | */ |
|
109 | private function addTestUser($manager) |
|
110 | { |
|
111 | $user = new User(); |
|
112 | ||
113 | $user->setUsername('test'); |
|
114 | $user->setEmail('[email protected]'); |
|
115 | ||
116 | $factory = $this->container->get('security.encoder_factory'); |
|
117 | $encoder = $factory->getEncoder($user); |
|
118 | $password = $encoder->encodePassword('test', $user->getSalt()); |
|
119 | $user->setPassword($password); |
|
120 | ||
121 | $role = $manager->getRepository('Webcook\Cms\SecurityBundle\Entity\Role')->findAll(); |
|
122 | $user->addRole($role[0]); |
|
123 | ||
124 | $manager->persist($user); |
|
125 | } |
|
126 | ||
127 | ||
128 | /** |