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