本文整理匯總了PHP中Zend\Form\Form::getValue方法的典型用法代碼示例。如果您正苦於以下問題:PHP Form::getValue方法的具體用法?PHP Form::getValue怎麽用?PHP Form::getValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend\Form\Form
的用法示例。
在下文中一共展示了Form::getValue方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: createFromForm
/**
* createFromForm
*
* @param Form $form
* @return ZfcUser\Model\User
*/
public function createFromForm(Form $form)
{
$class = ZfcUser::getOption('user_model_class');
$user = new $class();
$user->setEmail($form->getValue('email'))->setPassword(Password::hash($form->getValue('password')))->setRegisterIp($_SERVER['REMOTE_ADDR'])->setRegisterTime(new DateTime('now'))->setEnabled(true);
if (ZfcUser::getOption('require_activation')) {
$user->setActive(false);
} else {
$user->setActive(true);
}
if (ZfcUser::getOption('enable_username')) {
$user->setUsername($form->getValue('username'));
}
if (ZfcUser::getOption('enable_display_name')) {
$user->setDisplayName($form->getValue('display_name'));
}
$this->events()->trigger(__FUNCTION__, $this, array('user' => $user, 'form' => $form));
$this->userMapper->persist($user);
return $user;
}
示例2: createFromForm
public function createFromForm(Form $form)
{
$user = new UserModel();
$user->setEmail($form->getValue('email'))->setDisplayName($form->getValue('display_name'))->setSalt($this->randomBytes(16))->setPassword($this->hashPassword($form->getValue('password'), $user->getSalt()));
$userId = $this->getUserMapper()->insert($user);
}