Working version#1
Conversation
| } | ||
|
|
||
|
|
||
| $roles = $this->entityManager->getRepository(Role::class)->findAll(); |
|
|
||
| 'options' => [ | ||
| 'label' => 'Role', | ||
| 'value_options' => $rolesselector, |
| 'name' => 'password', | ||
| 'required' => true, | ||
| 'filters' => [ | ||
| ['name' => 'StringTrim'], |
There was a problem hiding this comment.
No, it seems that You have been mistaken by old filters and new filters location
|
|
||
| // Get role object based on role Id from form | ||
| /** @var Role $role */ | ||
| $role = $this->entityManager->find(Role::class, ['roleId' => $data['role']]); |
There was a problem hiding this comment.
can't you just pass role id here? I guess doctrine is smart enough.
| /** @var Role $role */ | ||
| $role = $this->entityManager->find(Role::class, ['roleId' => $data['role']]); | ||
| // Set role to user | ||
| $user->addRole($role); |
There was a problem hiding this comment.
Also don't forget to remove previous role
| /** @var Role $role */ | ||
| $role = $this->entityManager->find(Role::class, ['roleId' => 2]); | ||
| // Set role to user | ||
| $user->addRole($role); |
|
|
||
| // Get role object based on role Id from form | ||
| /** @var Role $role */ | ||
| $role = $this->entityManager->find(Role::class, ['roleId' => 2]); |
| 'placeholder'=>'John Doe' | ||
| ]); | ||
|
|
||
| $form->get('role')->setAttributes([ |
There was a problem hiding this comment.
write it in template instead of using jquery
There was a problem hiding this comment.
did it as it is at native code, so no idea what do You want here
| 'placeholder'=>'John Doe' | ||
| ]); | ||
|
|
||
| $form->get('role')->setAttributes([ |
There was a problem hiding this comment.
did it as it is at native code, so no idea what do You want here
| public function getRolesSelector() | ||
| { | ||
| $roles = $this->entityManager->getRepository(Role::class)->findAll(); | ||
| $hydrator = new \Zend\Hydrator\ClassMethods(); |
| { | ||
| // checking for existing role if editing mode | ||
| $rolecurrent['role_id'] = self::GUEST_ROLE_ID; | ||
| $hydrator = new \Zend\Hydrator\ClassMethods(); |
| if ($allow=='*') | ||
| return true; // Anyone is allowed to see the page. | ||
| else if ($allow=='@' && $this->authService->hasIdentity()) { | ||
| else if (($allow=='@' || is_array($allow)) && $this->authService->hasIdentity()) { |
There was a problem hiding this comment.
I don't really like the @ behaviour. It cab be easily resolved with "user" role which cover every logged in user.
No description provided.