本文整理匯總了PHP中UserMapper::clear方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserMapper::clear方法的具體用法?PHP UserMapper::clear怎麽用?PHP UserMapper::clear使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UserMapper
的用法示例。
在下文中一共展示了UserMapper::clear方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: findAction
public function findAction()
{
$request = new Request();
$request->initRequest();
$post = $request->getPost();
$roadMapper = new RoadMapper();
$roads = $roadMapper->getByStartFinish($post['departure_point'], $post['destination_point'], "opened");
$userMapper = new UserMapper();
$carMapper = new CarMapper();
$result = array();
if ($roads) {
foreach ($roads as $road) {
$user = $userMapper->getUserByEmail($road->driverid);
$car = $carMapper->getByAutoId($road->autoid);
$roadMapper->clear();
$getPoints = $roadMapper->getRoutPointsByRoad($road->id);
$routPoints = array();
foreach ($getPoints as $point) {
$routPoints[$point->pointqueue] = $point->point;
}
$result[] = array('startdate' => $road->startdate, 'start' => $road->start, 'start_adress' => $road->start_adress, 'finish' => $road->finish, 'finish_adress' => $road->finish_adress, 'freeseats' => $road->freeseats, 'price' => $road->price, 'terms' => $road->terms, 'rout_points' => $routPoints, 'username' => $user->username, 'surname' => $user->surname, 'rate' => $user->rate, 'photo' => $user->photo, 'age' => $user->getAge(), 'car_brand' => $car->brand, 'car_model' => $car->model);
$userMapper->clear();
$carMapper->clear();
$roadMapper->clear();
}
}
echo json_encode($result);
}
示例2: saveAction
public function saveAction()
{
$message = ErMessenger::getInstance();
$request = new Request();
$request->initRequest();
$post = $request->getPost();
if (isset($post)) {
$userEmail = ErSession::getFromSession('user');
$userMapper = new UserMapper();
$user = $userMapper->getUserByEmail($userEmail);
$user->username = $this->clearStr($post['username']);
$user->surname = $this->clearStr($post['surname']);
$user->birthday = $this->clearStr($post['birthday']);
$user->gendor = $this->clearStr($post['gendor']);
$user->phone = $this->clearStr($post['phone']);
if ($post['password_changed']) {
$user->userpassword = hash("md5", $this->clearStr($post['userpassword']));
}
$userMapper->clear();
if ($userMapper->updateUser($user)) {
$message->setSucceedMessage('202', 'user/private');
} else {
$message->setErrMessage('100', 'user/private');
}
echo json_encode($this->fetchUserData($userEmail));
}
}