예제 #1
0
 /**
  * Finds the Post model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  *
  * @param string $slug Term Slug
  * @throws \yii\web\NotFoundHttpException
  * @internal param string $postslug
  * @return Term the loaded model
  */
 protected function findModelBySlug($slug)
 {
     $model = Term::findOne(['slug' => $slug]);
     if ($model) {
         return $model;
     }
     throw new NotFoundHttpException(Yii::t('writesdown', 'The requested page does not exist.'));
 }
예제 #2
0
 /**
  * Finds the Term model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  *
  * @param integer $id
  *
  * @return Term|false the loaded model
  */
 protected function findTerm($id)
 {
     if ($model = Term::findOne($id)) {
         return $model;
     } else {
         return false;
     }
 }
예제 #3
0
 /**
  * @param AcceptanceTester $I
  */
 public function testUpdateTerm(AcceptanceTester $I)
 {
     $I->wantTo('ensure that update term works');
     $updateTermPage = UpdateTermPage::openBy($I);
     $I->see('View Taxonomy: Tag');
     $I->amGoingTo('submit update term form');
     $updateTermPage->submit(['slug' => 'new-sample-tag-slug', 'description' => 'New sample tag description']);
     $I->expectTo('see the term updated');
     $I->see('New sample tag description', '#term-grid-view');
     $I->see('new-sample-tag-slug', '#term-grid-view');
     Term::findOne(2)->updateAttributes(['description' => 'This is sample tag description', 'slug' => 'sample-tag hlhl']);
 }
예제 #4
0
 /**
  * Finds the Term model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  *
  * @param integer $id
  * @return Term the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Term::findOne($id)) !== null) {
         return $model;
     }
     throw new NotFoundHttpException('The requested page does not exist.');
 }
예제 #5
0
 /**
  * Finds the Term model based on its primary key value.
  * If the model is not found, it return false.
  *
  * @param integer $id
  *
  * @return Term|bool|null|static
  */
 protected function findTerm($id)
 {
     if (($model = Term::findOne($id)) !== null) {
         return $model;
     }
     return false;
 }
예제 #6
0
 /**
  * Finds the Term model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  *
  * @param integer $id
  * @return Term the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findTerm($id)
 {
     if (($model = Term::findOne($id)) !== null) {
         return $model;
     }
     throw new NotFoundHttpException(Yii::t('writesdown', 'The requested page does not exist.'));
 }
예제 #7
0
 /**
  * Finds the Post model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  *
  * @param $term_slug
  *
  * @throws \yii\web\NotFoundHttpException
  * @internal param string $post_slug
  *
  * @return Term the loaded model
  */
 protected function findModelBySlug($term_slug)
 {
     $model = Term::findOne(['term_slug' => $term_slug]);
     if ($model) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }