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


PHP Movie::model方法代码示例

本文整理汇总了PHP中Movie::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Movie::model方法的具体用法?PHP Movie::model怎么用?PHP Movie::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Movie的用法示例。


在下文中一共展示了Movie::model方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: beforeInsert

 private function beforeInsert()
 {
     $this->log_content = Callback::searchMovie($this->query);
     foreach ($this->getContent() as $movie_info) {
         if (!Movie::model()->with('attributes')->find('tmdb_id=:id', array(':id' => $movie_info['imdb_id']))) {
             $movie = new Movie();
             $movie->setUrlKey($movie_info);
             $movie->tmdb_id = $movie_info['id'];
             $movie->imdb_id = $movie_info['imdb_id'];
             $movie->save();
         }
     }
 }
开发者ID:unused,项目名称:yii-lmdb,代码行数:13,代码来源:SearchLog.php

示例2: array

<?php

$this->pageTitle = Yii::app()->name . ' - Dashboard';
?>

<?php 
$this->widget('zii.widgets.jui.CJuiAccordion', array('panels' => array('Recent Comments' => $this->renderPartial('_list', array('items' => Comment::model()->recent()->findAll()), true), 'LMDB Popular Movies' => $this->renderPartial('_list', array('items' => Movie::model()->popular()->findAll()), true), 'Top Public Movies' => $this->renderPartial('_list', array('items' => MovieAttributes::model()->top()->findAll()), true), 'Recent Added Movies' => $this->renderPartial('_list', array('items' => Movie::model()->recent()->findAll()), true), 'Recent Searches' => $this->renderPartial('_list', array('items' => SearchLog::model()->recent()->findAll()), true)), 'options' => array('animated' => 'bounceslide')));
开发者ID:unused,项目名称:yii-lmdb,代码行数:7,代码来源:index.php

示例3: 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.
  */
 public function loadModel($query = '')
 {
     if ($this->_model === null) {
         if (isset($_GET['id'])) {
             //         switch($query)
             //         {
             //           case 'tmdb':
             $this->_model = Movie::model()->with(array('attributes', 'images'))->find('tmdb_id=:id', array(':id' => $_GET['id']));
         }
         //             break;
         //           default:
         //             $this->_model=Movie::model()->with(array('attributes', 'images'))->findbyPk($_GET['id']);
         //         }
         if (isset($_GET['url_key'])) {
             $this->_model = Movie::model()->with(array('attributes', 'images'))->find('url_key LIKE :url_key', array(':url_key' => $_GET['url_key']));
         }
         if ($this->_model === null) {
             throw new CHttpException(404, 'The requested page does not exist.');
         }
     }
     return $this->_model;
 }
开发者ID:unused,项目名称:yii-lmdb,代码行数:26,代码来源:MovieController.php

示例4: setUrlKey

 public function setUrlKey($attributes)
 {
     $url_key = strtolower(preg_replace('/\\W+/', '-', $attributes['name']));
     // if name is already given, add the release date
     if (Movie::model()->find('url_key LIKE :url_key', array(':url_key' => $url_key))) {
         $url_key .= "-" . substr($attributes['released'], 0, 4);
     }
     // if url_key is still not unique add a number
     $tmp_key = $url_key;
     for ($num = 1; Movie::model()->find('url_key LIKE :url_key', array(':url_key' => $url_key)); $num++) {
         $url_key = $tmp_key . "-{$num}";
     }
     $this->url_key = $url_key;
 }
开发者ID:unused,项目名称:yii-lmdb,代码行数:14,代码来源:Movie.php


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