/**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $adminUser = new User();
     $profil = new Profil();
     $adminUser->setUsername('jules');
     $adminUser->setPrenom('Souleymane');
     $adminUser->setNom('MBAYE');
     $adminUser->setEmail('*****@*****.**');
     $profil->setLibelle("ADMIN");
     $adminUser->addProfil($profil);
     $manager->persist($adminUser);
     $manager->flush();
 }
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $adminUser = new User();
     $profil = new Profil();
     $adminUser->setUsername('jules');
     $adminUser->setPrenom('Souleymane');
     $adminUser->setNom('MBAYE');
     $adminUser->setEmail('*****@*****.**');
     $profil->setLibelle("ADMIN");
     $adminUser->addProfil($profil);
     $encoder = $this->container->get('security.encoder_factory')->getEncoder($adminUser);
     $adminUser->setPassword($encoder->encodePassword('diama', $adminUser->getSalt()));
     $manager->persist($adminUser);
     $manager->flush();
 }
Пример #3
0
 /**
  * Add profils
  *
  * @param \SMB\UserBundle\Entity\SMBUserBundle:Profil $profils
  * @return User
  */
 public function addProfil(\SMB\UserBundle\Entity\Profil $profils)
 {
     $this->profils[] = $profils;
     //on met le role sous son format
     $role = "ROLE_" . $profils->getLibelle();
     //on ajoute le profil comme role
     $this->setRoles(array($role));
     //on lie le profil à l'utilisateur
     $profils->addUtilisateur($this);
     return $this;
 }