当前位置: 首页>>代码示例>>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;未经允许,请勿转载。