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


PHP Post::deleteAll方法代码示例

本文整理汇总了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');
 }
开发者ID:ockor,项目名称:yii2adv-blog,代码行数:13,代码来源:AdminController.php

示例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']);
 }
开发者ID:hdushku,项目名称:app-cms,代码行数:21,代码来源:PostCest.php

示例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']]);
 }
开发者ID:liasica,项目名称:yiiforum,代码行数:17,代码来源:ThreadController.php

示例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']]);
 }
开发者ID:liasica,项目名称:yiiforum,代码行数:14,代码来源:ThreadController.php


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