本文整理汇总了PHP中UserDao::save方法的典型用法代码示例。如果您正苦于以下问题:PHP UserDao::save方法的具体用法?PHP UserDao::save怎么用?PHP UserDao::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserDao
的用法示例。
在下文中一共展示了UserDao::save方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: subscribe
public function subscribe(User $user, $confirm_pass)
{
if ($user->password() == $confirm_pass) {
return $this->dao->save($user);
} else {
throw new Exception('Senhas informadas não conferem');
}
}
示例2: createUser
static function createUser($nickname, $email, $password, $role)
{
$pwd = Filter::encodePassword($password);
$user = new User($nickname, $email, $pwd);
$user->setRole($role);
$userdao = new UserDao();
$u = $userdao->save($user);
//invia una mail per permettere all'utente di convalidare la sua casella.
$code = self::generateValidationCode($u);
mail($u->getEMail(), "Iscrizione a IoEsisto", self::generateValidationMailMessage($code));
//genera una collection di preferiti
require_once 'manager/CollectionManager.php';
$data = array("title" => "Preferiti", "author" => $u->getID(), "categories" => "favourites", "visible" => false, "type" => "collection");
//TODO la collection viene creata nel db ma da fatal error, forse il problema è nell'override di setContent dove controlla che si stia inserendo un post ma il contenuto è false
//CollectionManager::createCollection($data);
//TODO creare MailManager
//genera tre directory email: mailbox, cestino e spam
//require_once("manager/MailManager.php");
//MailManager::createDirectory(MAILBOX, $u->getID());
//MailManager::createDirectory(TRASH, $u->getID());
//MailManager::createDirectory(SPAM, $u->getID());
return $u;
}
示例3: save
}
}
public function save($userName, $userPwd)
{
try {
$sql = "insert into user values(?,?,?)";
//set the time format
$rTime = date("Y-m-d h:i:s");
//begin the transaction
$this->pdo->beginTransaction();
$stmt = $this->pdo->prepare($sql);
$stmt->bindParam(1, $userName, PDO::PARAM_STR);
$stmt->bindParam(2, $userPwd, PDO::PARAM_STR);
$stmt->bindParam(3, $rTime, PDO::PARAM_STR);
$stmt->execute();
//there is no tips when occures the commit
$this->pdo->commit();
//show results
//$this->testConn();
//close the database
$this->dbUtil->close();
} catch (PDOException $e) {
echo date("Y-m-d h:i:s") . " :Fail:" . $e->getMessage();
}
}
}
//main test
$userDao = new UserDao();
//$userDao->testConn();
$userDao->save('matrix', '121550');
示例4: array
<?php
$errors = array();
$User = null;
$edit = array_key_exists('id', $_GET);
if ($edit) {
$User = Utils::getUserByGetId();
} else {
// set defaults
$User = new User();
//$User->setDate(new DateTime());
}
if (array_key_exists('cancel', $_POST)) {
} elseif (array_key_exists('save', $_POST)) {
$data = array('email' => $_POST['Users']['email'], 'password' => $_POST['Users']['password']);
// map
UserMapper::map($User, $data);
// validate
$errors = UserValidator::validate($User);
// validate
if (empty($errors)) {
// save
$dao = new UserDao();
$User = $dao->save($User);
Flash::addFlash('Success Booking :)');
// redirect
Utils::redirect('home');
}
}
示例5: UserDao
<?php
//status of list
$status = Utils::getUrlParam('status');
//command
$cmd = Utils::getUrlParam('cmd');
$flightBooking = Utils::getUserByGetId();
$flightBooking->setStatus($cmd);
$dao = new UserDao();
$dao->save($flightBooking);
$msg = '';
if ($cmd === User::VOIDED) {
$smg = 'User deleted successfully.';
} else {
$smg = 'User changed successfully.';
}
Flash::addFlash($smg);
Utils::redirect('list', array('status' => $status));
示例6: array
<?php
$errors = array();
$user = null;
$edit = array_key_exists('id', $_GET);
if ($edit) {
$user = Utils::getUserByGetId();
} else {
$user = new User();
}
if (array_key_exists('cancel', $_POST)) {
} elseif (array_key_exists('save', $_POST)) {
$data = array('first_name' => $_POST['user']['first_name'], 'user_password' => $_POST['user']['user_password']);
// map
UserMapper::map($user, $data);
// validate
$errors = UserValidator::validate($user);
// validate
if (empty($errors)) {
// save
$dao = new UserDao();
$user = $dao->save($user);
Flash::addFlash('Success sign in :)');
// redirect
Utils::redirect('home');
}
}