當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Artist::model方法代碼示例

本文整理匯總了PHP中Artist::model方法的典型用法代碼示例。如果您正苦於以下問題:PHP Artist::model方法的具體用法?PHP Artist::model怎麽用?PHP Artist::model使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Artist的用法示例。


在下文中一共展示了Artist::model方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: unlinkArtistFromAlbums

 protected function unlinkArtistFromAlbums($artistid)
 {
     $sql = "DELETE FROM  artist_album WHERE artist_id=:artist_id";
     $command = Artist::model()->getDbConnection()->createCommand($sql);
     $command->bindValues(array(":artist_id" => $artistid));
     $command->execute();
     return true;
 }
開發者ID:imanifaiz,項目名稱:angular-music-db,代碼行數:8,代碼來源:ArtistController.php

示例2: loadModel

 /**
  * 返回基於主鍵值的數據模型,主鍵值由 GET 變量提供。
  * 若數據模型沒有找到,一個 HTTP 異常被喚起。
  */
 public function loadModel()
 {
     if ($this->_model === null) {
         if (isset($_GET['id'])) {
             if (Yii::app()->user->name == "admin") {
                 $condition = '';
             } else {
                 $condition = 'proved=' . Artist::STATUS_PROVED;
             }
             $this->_model = Artist::model()->findbyPk($_GET['id'], $condition);
         }
         if ($this->_model === null) {
             throw new CHttpException(404, '您所請求的頁麵不存在。');
         }
     }
     return $this->_model;
 }
開發者ID:robebeye,項目名稱:MusicDream,代碼行數:21,代碼來源:ArtistController.php

示例3: run

 public function run()
 {
     $model = new Album();
     if (isset($_GET['artist_id'])) {
         $artist_id = $_GET['artist_id'];
         $artist_info = Artist::model()->findByPk($artist_id);
         $model->artist_id = $artist_id;
     }
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Album'])) {
         $model->attributes = $_POST['Album'];
         $model->image = CUploadedFile::getInstance($model, 'image');
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
開發者ID:robebeye,項目名稱:MusicDream,代碼行數:19,代碼來源:CreateAction.php

示例4: run

 public function run($region = 1, $type = 2)
 {
     $criteria = new CDbCriteria();
     $criteria->condition = 'proved=:proved';
     $criteria->params = array(':proved' => Artist::STATUS_PROVED);
     $criteria->order = "sort ASC,add_time DESC";
     $criteria->group = 'sort,id';
     $region = (int) $region;
     $type = (int) $type;
     $criteria->addSearchCondition('area_id', $region);
     $criteria->addSearchCondition('type_id', $type);
     $rawData = Artist::model()->findAll($criteria);
     $value = Yii::app()->cache->get('ARTISTS_' . $region . '_' . $type);
     if ($value === false) {
         $dataProvider = new CArrayDataProvider($rawData, array('id' => 'artist', 'pagination' => array('pageSize' => 500)));
         Yii::app()->cache->set('ARTISTS_' . $region . '_' . $type, $dataProvider, 10);
     } else {
         $dataProvider = $value;
     }
     $regionData = ArtistArea::model()->findByPk($region);
     $typeData = ArtistType::model()->findByPk($type);
     $this->render('index', array('dataProvider' => $dataProvider, 'region' => $region, 'type' => $type, 'regionData' => $regionData, 'typeData' => $typeData));
 }
開發者ID:robebeye,項目名稱:MusicDream,代碼行數:23,代碼來源:IndexAction.php

示例5: loadModel

 /**
  * 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 Artist the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Artist::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
開發者ID:hayao0,項目名稱:Test,代碼行數:15,代碼來源:ArtistController.php

示例6: afterFind

 protected function afterFind()
 {
     parent::afterFind();
     $this->_tags = $this->_oldTags = ItemsTags::returnTagsString(ItemsTags::ARTIST_TYPE, $this->id);
     Artist::model()->updateCounters(array('click' => 1), 'id=:id', array(':id' => $this->id));
 }
開發者ID:robebeye,項目名稱:MusicDream,代碼行數:6,代碼來源:Artist.php


注:本文中的Artist::model方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。