コード例 #1
0
ファイル: NewAccountMail.php プロジェクト: sandboxwebs/mo
 public function __construct(User $user)
 {
     $this->user = $user;
     $this->html_template = 'mail_activation.html.twig';
     $this->text_template = 'mail_activation.text.twig';
     $this->subject = 'Welcome ' . $user->getUsername() . ' , you need to activate your account.';
     $this->to = $user->getEmail();
 }
コード例 #2
0
ファイル: LoadUsersData.php プロジェクト: sandboxwebs/mo
 public function load(ObjectManager $manager)
 {
     $user = new User();
     $admin = new User();
     $pass = '******';
     $encoder = $this->container->get('security.password_encoder');
     $encoded = $encoder->encodePassword($user, $pass);
     $user->setEmail('*****@*****.**');
     $user->setIsActive(1);
     $user->setPassword($encoded);
     $user->setRoles('ROLE_USER');
     $manager->persist($user);
     $manager->flush();
     $admin->setEmail('*****@*****.**');
     $admin->setIsActive(1);
     $admin->setUsername('admin');
     $admin->setPassword($encoded);
     $admin->setRoles('ROLE_ADMIN');
     $manager->persist($admin);
     $manager->flush();
     $this->addReference('user', $user);
 }