本文整理匯總了PHP中common\models\Post::deleteAll方法的典型用法代碼示例。如果您正苦於以下問題:PHP Post::deleteAll方法的具體用法?PHP Post::deleteAll怎麽用?PHP Post::deleteAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類common\models\Post
的用法示例。
在下文中一共展示了Post::deleteAll方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: actionDeletePost
public function actionDeletePost()
{
$selection = (array) Yii::$app->request->post('selection');
foreach ($selection as $id) {
Post::deleteAll(['id' => $id]);
Like::deleteAll(['post_id' => $id]);
Comment::deleteAll(['post_id' => $id]);
PostTag::deleteAll(['post_id' => $id]);
PostNotification::deleteAll(['post_id' => $id]);
PostProtected::deleteAll(['post_id' => $id]);
}
return $this->render('post-manage');
}
示例2: testCreate
public function testCreate(AcceptanceTester $I)
{
$I->wantTo('ensure that create post works');
$createPage = CreatePage::openBy($I);
$I->see('Add New Post', 'h1');
$I->see('Categories');
$I->see('Tags');
$I->amGoingTo('submit create post form with no data');
$createPage->submit([]);
$I->expectTo('see validation errors');
$I->see('Title cannot be blank.', '.help-block');
$I->amGoingTo('submit create post form with same title');
$createPage->submit(['post_title' => 'Sample Post']);
$I->expectTo('see that title already taken');
$I->see('Title "Sample Post" has already been taken.', '.help-block');
$I->amGoingTo('submit create post form with correct data');
$createPage->submit(['post_title' => 'New Test Post Title', 'post_slug' => 'new-test-post-title', 'post_content' => 'New Test Post Content']);
$I->expect('new post saved');
$I->see('Post successfully saved.', '.alert');
Post::deleteAll(['post_title' => 'New Test Post Title']);
}
示例3: actionDelete
/**
* Deletes an existing Thread model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id)
{
if (!YiiForum::checkAuth('thread_delete')) {
return $this->noPermission();
}
YiiForum::checkIsGuest();
$thread = $this->findModel($id);
$thread->delete();
Post::deleteAll(['thread_id' => $thread['id']]);
return $this->redirect(['index', 'boardid' => $thread['board_id']]);
}
示例4: actionDelete
/**
* Deletes an existing Thread model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id)
{
$this->checkIsGuest();
$thread = $this->findModel($id);
$thread->delete();
Post::deleteAll(['thread_id' => $thread['id']]);
return $this->redirect(['index', 'boardid' => $thread['board_id']]);
}