Esempio n. 1
0
 public function __construct(ObjectManager $objectManager, ModuleOptions $options, RoleRepository $roleRepository)
 {
     parent::__construct('role');
     $this->roleRepository = $roleRepository;
     $role = $options->getRoleEntity();
     $this->setObject(new $role());
     $this->setHydrator(new DoctrineObject($objectManager));
     $this->add(array('name' => 'id', 'type' => 'Hidden'));
     $this->add(array('name' => 'name', 'type' => 'Text', 'options' => array('label' => _('Name')), 'attributes' => array('placeholder' => _('Role name'))));
     $this->add(array('name' => 'permissions', 'type' => 'DoctrineModule\\Form\\Element\\ObjectSelect', 'options' => array('label' => _('Permissions'), 'object_manager' => $objectManager, 'target_class' => $options->getPermissionEntity(), 'property' => 'name', 'empty_option' => _('Please choose')), 'attributes' => array('multiple' => true)));
     $this->add(array('name' => 'secret', 'type' => 'csrf'));
     $this->add(array('name' => 'submit', 'type' => 'Button', 'options' => array('label' => _('Save')), 'attributes' => array('type' => 'submit')));
 }
Esempio n. 2
0
 /**
  * @param ObjectManager $objectManager
  * @param UserInterface $user
  * @param RoleInterface $role
  */
 public function __construct(ObjectManager $objectManager, ModuleOptions $options, UserRepository $userRepository)
 {
     parent::__construct('user');
     $this->userRepository = $userRepository;
     $this->options = $options;
     $user = $options->getUserEntity();
     $this->setObject(new $user());
     $this->setHydrator(new DoctrineObject($objectManager));
     $this->add(array('name' => 'id', 'type' => 'Hidden'));
     $this->add(array('name' => 'email', 'type' => 'Text', 'options' => array('label' => _('Email')), 'attributes' => array('placeholder' => _('Email'))));
     $this->add(array('name' => 'password', 'type' => 'Usermanager\\Form\\Element\\Password', 'options' => array('label' => _('Password')), 'attributes' => array('placeholder' => _('Password'))));
     $this->add(array('name' => 'password-verify', 'type' => 'Password', 'options' => array('label' => _('Verify password')), 'attributes' => array('placeholder' => _('Verify password'))));
     $this->add(array('name' => 'roles', 'type' => 'DoctrineModule\\Form\\Element\\ObjectSelect', 'options' => array('label' => _('Roles'), 'object_manager' => $objectManager, 'target_class' => $options->getRoleEntity(), 'property' => 'name', 'empty_option' => _('Please choose')), 'attributes' => array('multiple' => true)));
     $this->add(array('name' => 'secret', 'type' => 'csrf'));
     $this->add(array('name' => 'submit', 'type' => 'Button', 'options' => array('label' => _('Save')), 'attributes' => array('type' => 'submit')));
 }