setName() public method

Set name.
public setName ( string $name ) : Group
$name string
return Group
Exemplo n.º 1
0
 public function setUp()
 {
     $this->em = $this->db('ORM')->getOm();
     $this->purgeDatabase();
     $datetime = new \DateTime();
     $role1 = new Role();
     $role1->setName('Sulu Administrator');
     $role1->setSystem('Sulu');
     $this->em->persist($role1);
     $this->role1 = $role1;
     $role2 = new Role();
     $role2->setName('Sulu Manager');
     $role2->setSystem('Sulu');
     $this->em->persist($role2);
     $this->role2 = $role2;
     $group1 = new Group();
     $group1->setName('Group1');
     $group1->addRole($role1);
     $group1->addRole($role2);
     $this->em->persist($group1);
     $this->group1 = $group1;
     $group2 = new Group();
     $group2->setName('Group2');
     $group2->addRole($role1);
     $this->em->persist($group2);
     $this->group2 = $group2;
     $this->em->flush();
 }
Exemplo n.º 2
0
 /**
  * Creates a new group with the given data.
  *
  * @param \Symfony\Component\HttpFoundation\Request $request
  *
  * @throws \Sulu\Component\Rest\Exception\EntityNotFoundException
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function postAction(Request $request)
 {
     $name = $request->get('name');
     if ($name != null) {
         $em = $this->getDoctrine()->getManager();
         $group = new Group();
         $group->setName($name);
         $this->setParent($group);
         $roles = $request->get('roles');
         if (!empty($roles)) {
             foreach ($roles as $roleData) {
                 $this->addRole($group, $roleData);
             }
         }
         $em->persist($group);
         $em->flush();
         $view = $this->view($group, 200);
     } else {
         $view = $this->view(null, 400);
     }
     return $this->handleView($view);
 }
Exemplo n.º 3
0
 public function setUp()
 {
     $this->em = $this->db('ORM')->getOm();
     $this->purgeDatabase();
     $emailType = new EmailType();
     $emailType->setName('Private');
     $this->em->persist($emailType);
     $email1 = new Email();
     $email1->setEmail('*****@*****.**');
     $email1->setEmailType($emailType);
     $this->em->persist($email1);
     // Contact
     $contact1 = new Contact();
     $contact1->setFirstName('Max');
     $contact1->setLastName('Mustermann');
     $contact1->addEmail($email1);
     $this->em->persist($contact1);
     $this->contact1 = $contact1;
     $email = new Email();
     $email->setEmail('*****@*****.**');
     $email->setEmailType($emailType);
     $this->em->persist($email);
     $contact2 = new Contact();
     $contact2->setFirstName('Max');
     $contact2->setLastName('Muster');
     $contact2->addEmail($email);
     $this->em->persist($contact2);
     $this->contact2 = $contact2;
     $contact3 = new Contact();
     $contact3->setFirstName('Disabled');
     $contact3->setLastName('User');
     $contact3->addEmail($email);
     $this->em->persist($contact3);
     $this->contact3 = $contact3;
     $this->em->flush();
     $role1 = new Role();
     $role1->setName('Role1');
     $role1->setSystem('Sulu');
     $this->em->persist($role1);
     $this->role1 = $role1;
     $role2 = new Role();
     $role2->setName('Role2');
     $role2->setSystem('Sulu');
     $this->em->persist($role2);
     $this->role2 = $role2;
     // User 1
     $user = new User();
     $user->setUsername('admin');
     $user->setEmail('*****@*****.**');
     $user->setPassword('securepassword');
     $user->setSalt('salt');
     $user->setLocale('de');
     $user->setContact($contact2);
     $this->em->persist($user);
     $this->user1 = $user;
     // User 2
     $user1 = new User();
     $user1->setUsername('disabled');
     $user1->setEmail('*****@*****.**');
     $user1->setPassword('securepassword');
     $user1->setSalt('salt');
     $user1->setLocale('de');
     $user1->setContact($contact3);
     $user1->setEnabled(false);
     $this->em->persist($user1);
     $this->user2 = $user1;
     $this->em->flush();
     $userRole1 = new UserRole();
     $userRole1->setRole($role1);
     $userRole1->setUser($user);
     $userRole1->setLocale(json_encode(['de', 'en']));
     $this->em->persist($userRole1);
     $userRole2 = new UserRole();
     $userRole2->setRole($role2);
     $userRole2->setUser($user);
     $userRole2->setLocale(json_encode(['de', 'en']));
     $this->em->persist($userRole2);
     $userRole3 = new UserRole();
     $userRole3->setRole($role2);
     $userRole3->setUser($user);
     $userRole3->setLocale(json_encode(['de', 'en']));
     $this->em->persist($userRole3);
     $permission1 = new Permission();
     $permission1->setPermissions(122);
     $permission1->setRole($role1);
     $permission1->setContext('Context 1');
     $this->em->persist($permission1);
     $permission2 = new Permission();
     $permission2->setPermissions(122);
     $permission2->setRole($role2);
     $permission2->setContext('Context 2');
     $this->em->persist($permission2);
     // user groups
     $group1 = new Group();
     $group1->setName('Group1');
     $group1->setLft(0);
     $group1->setRgt(0);
     $group1->setDepth(0);
     $this->em->persist($group1);
     $this->group1 = $group1;
     $group2 = new Group();
     $group2->setName('Group2');
     $group2->setLft(0);
     $group2->setRgt(0);
     $group2->setDepth(0);
     $this->em->persist($group2);
     $this->group2 = $group2;
     $this->em->flush();
 }
Exemplo n.º 4
0
 public function setUp()
 {
     $this->em = $this->db('ORM')->getOm();
     $this->purgeDatabase();
     // email
     $emailType = new EmailType();
     $emailType->setName('Private');
     $this->em->persist($emailType);
     $email = new Email();
     $email->setEmail('*****@*****.**');
     $email->setEmailType($emailType);
     $this->em->persist($email);
     $email2 = new Email();
     $email2->setEmail('*****@*****.**');
     $email2->setEmailType($emailType);
     $this->em->persist($email2);
     // Contact
     $contact1 = new Contact();
     $contact1->setFirstName('Max');
     $contact1->setLastName('Muster');
     $contact1->addEmail($email);
     $this->em->persist($contact1);
     $contact2 = new Contact();
     $contact2->setFirstName('Maria');
     $contact2->setLastName('Musterfrau');
     $contact2->addEmail($email2);
     $this->em->persist($contact2);
     $this->em->flush();
     $role1 = new Role();
     $role1->setName('Role1');
     $role1->setSystem('Sulu');
     $this->em->persist($role1);
     $role2 = new Role();
     $role2->setName('Role2');
     $role2->setSystem('Test');
     $this->em->persist($role2);
     // User 1
     $user = new User();
     $user->setUsername('admin');
     $user->setEmail('*****@*****.**');
     $user->setPassword('securepassword');
     $user->setPasswordResetToken('mySuperSecretToken');
     $user->setSalt('salt');
     $user->setLocale('de');
     $user->setContact($contact1);
     $this->em->persist($user);
     // User 2
     $user2 = new User();
     $user2->setUsername('test');
     $user2->setEmail('*****@*****.**');
     $user2->setPassword('securepassword');
     $user2->setSalt('salt');
     $user2->setLocale('de');
     $user2->setContact($contact2);
     $this->em->persist($user2);
     $this->em->flush();
     $userRole1 = new UserRole();
     $userRole1->setRole($role1);
     $userRole1->setUser($user);
     $userRole1->setLocale(json_encode(['de', 'en']));
     $this->em->persist($userRole1);
     $userRole2 = new UserRole();
     $userRole2->setRole($role2);
     $userRole2->setUser($user2);
     $userRole2->setLocale(json_encode(['de', 'en']));
     $this->em->persist($userRole2);
     $permission1 = new Permission();
     $permission1->setPermissions(122);
     $permission1->setRole($role1);
     $permission1->setContext('Context 1');
     $this->em->persist($permission1);
     $permission2 = new Permission();
     $permission2->setPermissions(122);
     $permission2->setRole($role2);
     $permission2->setContext('Context 2');
     $this->em->persist($permission2);
     // user groups
     $group1 = new Group();
     $group1->setName('Group1');
     $group1->setLft(0);
     $group1->setRgt(0);
     $group1->setDepth(0);
     $this->em->persist($group1);
     $group2 = new Group();
     $group2->setName('Group2');
     $group2->setLft(0);
     $group2->setRgt(0);
     $group2->setDepth(0);
     $this->em->persist($group2);
     $this->em->flush();
 }