本文整理汇总了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();
}
}
}
示例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')));
示例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;
}
示例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;
}