当前位置: 首页>>代码示例>>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;未经允许,请勿转载。