當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UserMapper::map方法代碼示例

本文整理匯總了PHP中UserMapper::map方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserMapper::map方法的具體用法?PHP UserMapper::map怎麽用?PHP UserMapper::map使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UserMapper的用法示例。


在下文中一共展示了UserMapper::map方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: findById

 public function findById($id)
 {
     $row = $this->query('SELECT * FROM users_tb WHERE id = ' . (int) $id)->fetch();
     if (!$row) {
         return null;
     }
     $user = new User();
     UserMapper::map($user, $row);
     return $user;
 }
開發者ID:beshad,項目名稱:dropoff_1_DEC_MAC_2204_ORDER_ORDER_TABLE_WORKS,代碼行數:10,代碼來源:UserDao.php

示例2: find

 public function find($type = null)
 {
     $result = array();
     foreach ($this->query($this->getFindSql($type)) as $row) {
         $user = new User();
         UserMapper::map($user, $row);
         $result[$user->getUserId()] = $user;
     }
     return result;
 }
開發者ID:raledon,項目名稱:runningOwl,代碼行數:10,代碼來源:UserDao.php

示例3: find

 public function find($status = null)
 {
     $result = array();
     $sql = 'SELECT id, first_name, user_password , status FROM user_tb WHERE ' . 'status = "' . $status . '";';
     foreach ($this->query($sql) as $row) {
         $user = new User();
         UserMapper::map($user, $row);
         $result[$user->getId()] = $user;
     }
     return $result;
 }
開發者ID:beshad,項目名稱:dropoff_test_26NOV_0003,代碼行數:11,代碼來源:UserDao.php

示例4: findUserByEmail

 public function findUserByEmail(User $user)
 {
     $result = array();
     $email = $user->getEmail();
     $sql = 'SELECT id FROM users_tb WHERE ' . 'email = "' . $email . '";';
     foreach ($this->query($sql) as $row) {
         $user = new User();
         UserMapper::map($user, $row);
     }
     return $user->getId();
 }
開發者ID:beshad,項目名稱:DROP_OFF_PROJECT_FRI1039,代碼行數:11,代碼來源:UserDao.php

示例5: read

 public function read()
 {
     $result = array();
     $sql = 'SELECT * FROM user_tb';
     foreach ($this->query($sql) as $row) {
         $user = new User();
         UserMapper::map($user, $row);
         $result[$user->getId()] = $user;
     }
     return $result;
 }
開發者ID:beshad,項目名稱:dropoff_practice_26NOV_0011,代碼行數:11,代碼來源:UserDao.php

示例6: find

 /**
   find user's detail by sql
 */
 public function find($status = null)
 {
     $result = array();
     $sql = 'SELECT user_id, first_name, last_name, email, phone_number FROM products;';
     //product_name
     foreach ($this->query($sql) as $row) {
         $user = new User();
         UserMapper::map($user, $row);
         $result[$user->getUserId()] = $user;
     }
     return $result;
 }
開發者ID:angela-chan,項目名稱:advanced-client-side-project,代碼行數:15,代碼來源:userDao.php

示例7: array

<?php

$errors = array();
$userObj = new User();
if (array_key_exists('signin', $_POST)) {
    $data = array('email' => $_POST['user']['email'], 'user_password' => $_POST['user']['user_password']);
    UserMapper::map($userObj, $data);
    $errors = Validator::validate($userObj);
    if (empty($errors)) {
        $dao = new UserDao();
        $_SESSION['user_id'] = $dao->createUser($userObj)->getId();
        Utils::redirect(dashboard);
    }
}
開發者ID:beshad,項目名稱:dropoff_1_DEC,代碼行數:14,代碼來源:home-script.php

示例8: User

<?php

$user_id = $_POST['user']['id'];
$user_obj = null;
$updatedUser_obj = null;
$user_obj = new User();
$updatedUser_obj = new User();
if (array_key_exists('find', $_POST)) {
    $data = array('id' => $_POST['user']['id']);
    UserMapper::map($user_obj, $data);
    $dao = new UserDao();
    $foundUser = $dao->findById($user_id);
}
if (array_key_exists('update', $_POST)) {
    $data = array('id' => $_POST['user']['id'], 'first_name' => $_POST['user']['first_name'], 'user_password' => $_POST['user']['user_password']);
    UserMapper::map($updatedUser_obj, $data);
    $dao = new UserDao();
    $dao->update($updatedUser_obj);
    Flash::addFlash('user record(s) updated successfully :)');
}
開發者ID:beshad,項目名稱:dropoff_practice_26NOV_0011,代碼行數:20,代碼來源:find-update-script.php

示例9: array

<?php

$errors = array();
$userObj = new User();
$addressObj = new Address();
$orderObj = new Order();
if (array_key_exists('submit', $_POST)) {
    $userData = array('id' => (int) $_SESSION['user_id'], 'first_name' => $_POST['user']['first_name'], 'last_name' => $_POST['user']['last_name']);
    $addressData = array('street_no' => $_POST['address']['street_no'], 'street' => $_POST['address']['street'], 'suburb' => $_POST['address']['suburb'], 'city' => $_POST['address']['city'], 'post_code' => $_POST['address']['post_code']);
    UserMapper::map($userObj, $userData);
    AddressMapper::map($addressObj, $addressData);
    //$errors = Validator::validate($userObj);
    //if (empty($errors)) {
    $userDao = new UserDao();
    $addressDao = new AddressDao();
    //    $_SESSION['address_id'] = ($addressDao->create($addressObj)->getId());
    $userDao->completeRegistration($userObj, $addressDao->createAddress($addressObj)->getId());
    //}
}
if (array_key_exists('order', $_POST)) {
    $orderData = array('order_details' => $_POST['orders']['order_details'], 'order_date' => $_POST['orders']['order_date'] . '00:00:00');
    OrderMapper::map($orderObj, $orderData);
    $orderDao = new OrderDao();
    $orderDao->createOrder($orderObj);
}
開發者ID:beshad,項目名稱:dropoff_1_DEC,代碼行數:25,代碼來源:dashboard-script.php

示例10: 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');
    }
}
開發者ID:beshad,項目名稱:dropoff_22nov,代碼行數:29,代碼來源:home-script.php

示例11: User

<?php

$user_id = $_POST['user']['id'];
$user_obj = null;
$user_obj = new User();
if (array_key_exists('delete', $_POST)) {
    $data = array('id' => $_POST['user']['id']);
    UserMapper::map($user_obj, $data);
    $dao = new UserDao();
    $dao->delete($user_id);
    Flash::addFlash('Record' . $user_id . ' deleted successfully :)');
}
開發者ID:beshad,項目名稱:dropoff_practice_28NOV_2227,代碼行數:12,代碼來源:delete-script.php

示例12: find

 /**
  * Find all {@link User}s by search criteria.
  * @return array array of {@link User}s
  */
 public function find(UserSearchCriteria $search = null)
 {
     $result = array();
     foreach ($this->query($this->getFindSql($search)) as $row) {
         $user = new Air2Java\model\Individu();
         UserMapper::map($user, $row);
         $result[$user->getId()] = $user;
     }
     return $result;
 }
開發者ID:Rom1deTroyes,項目名稱:Afpa2015,代碼行數:14,代碼來源:IndividusDao.php


注:本文中的UserMapper::map方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。