private function creatGroup($username, $password, $officialName, $groupType)
 {
     $stateGroup = new Group();
     $stateGroup->setUsername($username);
     $stateGroup->setManagerEmail('*****@*****.**');
     $stateGroup->setOfficialName($officialName);
     $stateGroup->setGroupType($groupType);
     $generator = new SecureRandom();
     $password = $generator->nextBytes(10);
     $stateGroup->setPassword($password);
     return $stateGroup;
 }
 public function load(ObjectManager $manager)
 {
     //create group
     $group = new Group();
     $group->setUsername(self::GROUP_NAME);
     $group->setManagerEmail(self::GROUP_EMAIL);
     //encode password according configuration
     $factory = $this->container->get('security.encoder_factory');
     $encoder = $factory->getEncoder($group);
     $password = $encoder->encodePassword(self::GROUP_PASSWORD, $group->getSalt());
     $group->setPassword($password);
     $manager->persist($group);
     $manager->flush();
     $this->addReference('group', $group);
 }
 private function creatGroup($username, $password, $officialName, $groupType, $parent = null)
 {
     $stateGroup = new Group();
     $stateGroup->setUsername($username);
     $stateGroup->setManagerEmail(self::COMMON_STATE_GROUP_EMAIL);
     $stateGroup->setOfficialName($officialName);
     $stateGroup->setGroupType($groupType);
     $stateGroup->setParent($parent);
     $stateGroup->setLocationName($username);
     $generator = new SecureRandom();
     $factory = $this->container->get('security.encoder_factory');
     $encoder = $factory->getEncoder($stateGroup);
     $password = $encoder->encodePassword(sha1($generator->nextBytes(10)), $stateGroup->getSalt());
     $stateGroup->setPassword($password);
     return $stateGroup;
 }
 public function setManagerEmail($managerEmail)
 {
     $this->__load();
     return parent::setManagerEmail($managerEmail);
 }