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


PHP UserMapper::delete方法代碼示例

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


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

示例1: run

 public function run()
 {
     $mapper = new UserMapper($this->adapter);
     $user = new \Cactus\Entity(array('name' => 'Mr. Test', 'password' => "testingpassword", 'create_date' => date("Y-m-d H:i:s")));
     list($id, $num) = $mapper->save($user);
     // Dont do this for real, but I need to clean up for testing
     $mapper->delete($user);
     return $num === 1;
 }
開發者ID:davewid,項目名稱:cactus,代碼行數:9,代碼來源:UserSeed.php

示例2: testDeleteUser

 public function testDeleteUser()
 {
     $user = getUserInstance('deleteUser');
     $umapper = new UserMapper(self::$pdo);
     $umapper->insert($user);
     $umapper->delete($user);
     $allUsers = $umapper->findAll()->fetchAll();
     $this->assertEmpty($allUsers);
 }
開發者ID:shimizu9128,項目名稱:nfcCheckin,代碼行數:9,代碼來源:UserMapperTest.php

示例3: deleteAction

 public function deleteAction($I_id)
 {
     // On vérifie si l'utilisateur connecté est bien un admin
     $this->isAdmin();
     // On appelle le modele UserMapper et on lui demande de supprimer le user qui a l'$I_id
     $O_userMapper = new UserMapper();
     $O_userMapper->delete($I_id);
     die(header('Location:/'));
 }
開發者ID:Vincent-Troccaz,項目名稱:safety,代碼行數:9,代碼來源:ControllerUser.php

示例4: eliminar

 public function eliminar()
 {
     $currentuser = $this->view->getVariable("currentusername");
     $user = $this->userMapper->findById($currentuser);
     // Does the post exist?
     if ($user == NULL) {
         throw new Exception(i18n("Username does not exist"));
     }
     // Delete the Jurado Popular object from the database
     $this->userMapper->delete($user);
     $this->view->setFlash(i18n("Deleted user"));
     session_unset();
     session_destroy();
     $this->view->redirect("preguntas", "index");
 }
開發者ID:xrlopez,項目名稱:TSW,代碼行數:15,代碼來源:UsersController.php

示例5: sizeof

//get user by username
$user = $userMapper->findOne(array("conditions" => array('username = ? ', "john doe")));
echo "Username: " . $user->username;
echo "<br />Articles of this user:<br />";
foreach ($user->articles as $article) {
    echo $article->title . '<br />';
}
//edit the user
$user->username = "johnny doe";
$userMapper->update($user);
//add a new user
$newUser = new User();
$newUser->username = "my username 2";
$userMapper->insert($newUser);
//delete a user
$userMapper->delete(4);
//get users with their articles
//get all users limited by 2, sorted by username ascending and eager load the article relationship
//only 2 queries - one for fetching the users and one for coupling the related articles
$users = $userMapper->findMany(array("limit" => 3, "sort" => array("username", "asc"), "relations" => array("Article")));
//4 queries: one for retrieving the users and 1 per user lazy loading the articles.
$users = $userMapper->findMany(array("limit" => 3, "sort" => array("username", "asc")));
echo sizeof($users) . " users found<br />";
foreach ($users as $user) {
    echo "<br />Username:" . $user->username . "<br />";
    if (sizeof($user->articles) > 0) {
        echo "Articles of this user:<br />";
        foreach ($user->articles as $article) {
            echo $article->title . "<br />";
        }
    } else {
開發者ID:bartronix,項目名稱:orm,代碼行數:31,代碼來源:index.php


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