本文整理汇总了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']]);
}