public function createService(ServiceLocatorInterface $serviceLocator) { $config = $serviceLocator->get('config'); $config = isset($config['usermanager']) ? $config['usermanager'] : array(); $redirectOptions = $serviceLocator->get('Usermanager\\Options\\RedirectOptions'); $unauthorizedOptions = $serviceLocator->get('Usermanager\\Options\\UnauthorizedOptions'); $options = new ModuleOptions($config); $options->setRedirectOptions($redirectOptions); $options->setUnauthorizedOptions($unauthorizedOptions); return $options; }
public function __construct(ObjectManager $objectManager, ModuleOptions $options) { parent::__construct('user'); $user = $options->getUserEntity(); $this->setObject(new $user()); $this->setHydrator(new DoctrineObject($objectManager)); $this->add(array('name' => 'email', 'type' => 'text', 'options' => array('label' => _('Email')))); $this->add(array('name' => 'password', 'type' => 'password', 'options' => array('label' => _('Password')))); $this->add(array('name' => 'secret', 'type' => 'csrf')); $this->add(array('name' => 'submit', 'type' => 'button', 'options' => array('label' => _('Sign in')), 'attributes' => array('type' => 'submit'))); }
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'))); }
/** * @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'))); }