Пример #1
0
 /**
  * @test
  */
 public function create()
 {
     $model = new WebPage();
     $model->attributes = array('title' => 'test', 'name' => "test", 'description' => "description test", 'keywords' => "test");
     $this->assertTrue($model->save());
     $model = new WebPage();
     $model->attributes = array('title' => 'testa', 'name' => "test");
     $this->assertFalse($model->save());
     $this->assertInstanceOf('WebPage', WebPage::model());
 }
Пример #2
0
 /**
  * Renvoie la page de code $pageName.
  * @param string $pageName
  * @return WebPage|null
  * @internal utiliser de préférence la méthode BaseController::getPage() qui encapsule cet appel
  */
 public static function getByName($pageName)
 {
     return WebPage::model()->findByAttributes(array('name' => $pageName));
 }
Пример #3
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return WebPage the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = WebPage::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }