当前位置: 首页>>代码示例>>PHP>>正文


PHP R::trashAll方法代码示例

本文整理汇总了PHP中RedBeanPHP\R::trashAll方法的典型用法代码示例。如果您正苦于以下问题:PHP R::trashAll方法的具体用法?PHP R::trashAll怎么用?PHP R::trashAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RedBeanPHP\R的用法示例。


在下文中一共展示了R::trashAll方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: merge

 public static function merge($name, array $names)
 {
     $index = array_search($name, $names);
     if ($index > -1) {
         array_splice($names, $index, 1);
     }
     $into = (new self($name))->bean();
     $trash = [];
     $records = $into->ownRecordList ?: [];
     if ($into === null) {
         throw new \Exception('merge into publisher does not exist');
     }
     foreach ($names as $_name) {
         $trash[] = $publisherBean = (new Publisher($_name))->bean();
         if ($publisherBean === null) {
             throw new \Exception('merge from publisher does not exist');
         }
         foreach ($publisherBean->ownRecordList as $bean) {
             $records[] = $bean;
         }
         $publisherBean->ownRecordList = [];
     }
     $into->ownRecordList = $records;
     R::trashAll($trash);
     return R::store($into);
 }
开发者ID:vallevista,项目名称:etm2.temp,代码行数:26,代码来源:Publisher.php

示例2: function

});
// Remove a board.
$app->post('/boards/remove', function () use($app, $jsonResponse) {
    $data = json_decode($app->environment['slim.input']);
    if (validateToken(true)) {
        $board = R::load('board', $data->boardId);
        if ($board->id == $data->boardId) {
            $before = $board->export();
            foreach ($board->sharedUser as $user) {
                if ($user->defaultBoard == $data->boardId) {
                    $user->defaultBoard = null;
                    R::store($user);
                }
            }
            R::trashAll($board->xownLane);
            R::trashAll($board->xownCategory);
            R::trash($board);
            R::exec('DELETE from board_user WHERE board_id = ?', [$data->boardId]);
            $jsonResponse->addAlert('success', 'Removed board ' . $board->name . '.');
            $actor = getUser();
            logAction($actor->username . ' removed board ' . $board->name, $before, null);
        }
        $jsonResponse->addBeans(getBoards());
        $jsonResponse->users = R::exportAll(getUsers());
    }
    $app->response->setBody($jsonResponse->asJson());
});
$app->post('/autoactions', function () use($app, $jsonResponse) {
    $data = json_decode($app->environment['slim.input']);
    if (validateToken(true)) {
        $board = R::load('board', $data->boardId);
开发者ID:BIGGANI,项目名称:TaskBoard,代码行数:31,代码来源:boardRoutes.php

示例3: deleteBeans

 /**
  * Shorthand method that will delete a collection of beans with *commit* and *rollback*  transactions
  * @param object $beans
  */
 public static function deleteBeans($beans)
 {
     R::begin();
     try {
         R::trashAll($beans);
         R::commit();
     } catch (Exception $e) {
         R::rollback();
     }
 }
开发者ID:diversen,项目名称:simple-php-classes,代码行数:14,代码来源:rb.php

示例4: removePerms

 public function removePerms()
 {
     if ($this->name !== 'Administrator') {
         $beans = R::findAll('perm', ' group_name = ? ', [$this->name]);
         R::trashAll($beans);
     }
     return $this;
 }
开发者ID:enpowi,项目名称:enpowi,代码行数:8,代码来源:Group.php

示例5: foreach

            $customer->website = (string) $input->website;
        }
        if (isset($input->ownOptions)) {
            foreach ($input->ownOptions as $option) {
                $customerOption = \RedBeanPHP\R::dispense("options", 1);
                foreach ($option as $key => $val) {
                    $customerOption->{$key} = $val;
                }
                $customer->ownOptions[] = $customerOption;
            }
        }
        \RedBeanPHP\R::store($customer);
        $app->response()->header('Content-Type', 'application/json');
        echo json_encode(\RedBeanPHP\R::exportAll($customer));
    } else {
        $app->response()->status(404);
    }
});
// handle DELETE requests
$app->delete('/customers/:id', function ($id) use($app) {
    //\RedBeanPHP\R::dependencies(array('options'=>array('customers')));
    // retrieve specified element record
    $customer = \RedBeanPHP\R::findOne('customers', 'id = ?', array($id));
    if ($customer) {
        \RedBeanPHP\R::trashAll($customer->ownOptions);
        \RedBeanPHP\R::trash($customer);
        $app->response()->status(204);
    } else {
        $app->response()->status(404);
    }
});
开发者ID:tezrosolutions,项目名称:slim-redbeans,代码行数:31,代码来源:customers.php


注:本文中的RedBeanPHP\R::trashAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。