本文整理汇总了PHP中RedBeanPHP\Facade::trashAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Facade::trashAll方法的具体用法?PHP Facade::trashAll怎么用?PHP Facade::trashAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RedBeanPHP\Facade
的用法示例。
在下文中一共展示了Facade::trashAll方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
/**
* Logs admin into the system
* @param $login
* @param $password
* @return \SkullyAdmin\Models\Admin|null
*/
public function login($login, $password)
{
/** @var \RedBean_SimpleModel $adminBean */
$adminBean = R::findOne('admin', "status = ? and email = ?", array(Admin::STATUS_ACTIVE, $login));
if (!empty($adminBean)) {
/** @var \SkullyAdmin\Models\Admin $admin */
$admin = $adminBean->box();
if ($admin->get('password_hash') == UtilitiesHelper::toHash($password, $admin->get('salt'), $this->app->config('globalSalt'))) {
$adminSessions = R::find('adminsession', "admin_id = ?", array($admin->getID()));
if (!empty($adminSessions)) {
R::trashAll($adminSessions);
}
// when everything ok, regenerate session
session_regenerate_id(true);
// change session ID for the current session and invalidate old session ID
$adminId = $admin->getID();
$sessionId = session_id();
$adminsession = $this->app->createModel('adminsession', array("admin_id" => $adminId, "session_id" => $sessionId));
$this->app->getSession()->set('adminId', $admin->getID());
R::store($adminsession);
return $admin;
}
}
return null;
}
示例2: testMultiDeleteUpdate
/**
* Test trashAll().
*/
public function testMultiDeleteUpdate()
{
testpack('test multi delete and multi update');
$beans = R::dispenseLabels('bean', array('a', 'b'));
$ids = R::storeAll($beans);
asrt((int) R::count('bean'), 2);
R::trashAll(R::batch('bean', $ids));
asrt((int) R::count('bean'), 0);
testpack('test assocManager check');
$rb = new OODB(R::getWriter());
try {
$rb->getAssociationManager();
fail();
} catch (RedException $e) {
pass();
}
}
示例3: deletePackageCost
function deletePackageCost($id)
{
$packageCost = R::find('packagecost', 'id=?', [$id]);
R::trashAll($packageCost);
}
示例4: delete
/**
* @param int $qid
*
* @return void
*/
public function delete($qid)
{
Facade::trash('questions', $qid);
$answersToDelete = Facade::findAll('answers', 'qid = :qid', [':qid' => $qid]);
Facade::trashAll($answersToDelete);
}