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


PHP Movie::save方法代码示例

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


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

示例1: doSave

 /**
  * Performs the work of inserting or updating the row in the database.
  *
  * If the object is new, it inserts it; otherwise an update is performed.
  * All related objects are also updated in this method.
  *
  * @param      PropelPDO $con
  * @return     int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  * @throws     PropelException
  * @see        save()
  */
 protected function doSave(PropelPDO $con)
 {
     $affectedRows = 0;
     // initialize var to track total num of affected rows
     if (!$this->alreadyInSave) {
         $this->alreadyInSave = true;
         // We call the save method on the following object(s) if they
         // were passed to this object by their coresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aMovie !== null) {
             if ($this->aMovie->isModified() || $this->aMovie->getCulture() && $this->aMovie->getCurrentMovieI18n()->isModified() || $this->aMovie->isNew()) {
                 $affectedRows += $this->aMovie->save($con);
             }
             $this->setMovie($this->aMovie);
         }
         // If this object has been modified, then save it to the database.
         if ($this->isModified()) {
             if ($this->isNew()) {
                 $pk = MovieI18nPeer::doInsert($this, $con);
                 $affectedRows += 1;
                 // we are assuming that there is only 1 row per doInsert() which
                 // should always be true here (even though technically
                 // BasePeer::doInsert() can insert multiple rows).
                 $this->setNew(false);
             } else {
                 $affectedRows += MovieI18nPeer::doUpdate($this, $con);
             }
             $this->resetModified();
             // [HL] After being saved an object is no longer 'modified'
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
开发者ID:br00k,项目名称:yavom,代码行数:46,代码来源:BaseMovieI18n.php

示例2: post_save

 public function post_save()
 {
     $movie = new Movie();
     $movie->nombre = Input::get('nombre');
     $movie->duracion = Input::get('duracion');
     $movie->save();
     return Redirect::to('movie');
 }
开发者ID:mdela,项目名称:movie-series,代码行数:8,代码来源:MovieController.php

示例3: 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

示例4: doSave

 /**
  * Performs the work of inserting or updating the row in the database.
  *
  * If the object is new, it inserts it; otherwise an update is performed.
  * All related objects are also updated in this method.
  *
  * @param      PropelPDO $con
  * @return     int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  * @throws     PropelException
  * @see        save()
  */
 protected function doSave(PropelPDO $con)
 {
     $affectedRows = 0;
     // initialize var to track total num of affected rows
     if (!$this->alreadyInSave) {
         $this->alreadyInSave = true;
         // We call the save method on the following object(s) if they
         // were passed to this object by their coresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aMovie !== null) {
             if ($this->aMovie->isModified() || $this->aMovie->isNew()) {
                 $affectedRows += $this->aMovie->save($con);
             }
             $this->setMovie($this->aMovie);
         }
         if ($this->aPerson !== null) {
             if ($this->aPerson->isModified() || $this->aPerson->isNew()) {
                 $affectedRows += $this->aPerson->save($con);
             }
             $this->setPerson($this->aPerson);
         }
         // If this object has been modified, then save it to the database.
         if ($this->isModified()) {
             if ($this->isNew()) {
                 $criteria = $this->buildCriteria();
                 $pk = BasePeer::doInsert($criteria, $con);
                 $affectedRows += 1;
                 $this->setNew(false);
             } else {
                 $affectedRows += MoviespersonsPeer::doUpdate($this, $con);
             }
             $this->resetModified();
             // [HL] After being saved an object is no longer 'modified'
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
开发者ID:rubensayshi,项目名称:propelsandbox,代码行数:50,代码来源:BaseMoviespersons.php

示例5: Game

include 'database_connection.php';
include 'classes/MediaItem.php';
include 'classes/Game.php';
include 'classes/Book.php';
include 'classes/Music.php';
include 'classes/Movie.php';
$game = new Game();
$game->setTitle('Watch Dogs');
$game->setDesc('Crappy shit wannabe hacker game');
$game->setRating(1);
$game->setTags(['dnt']);
print '<p>' . ($game->save() ? "Saving successful" : "Saving unsuccessful") . '</p>';
$book = new Book();
$book->setTitle('Momo');
$book->setDesc('Dreamy and so on');
$book->setRating(4);
$book->setTags(['tc']);
print '<p>' . ($book->save() ? "Saving successful" : "Saving unsuccessful") . '</p>';
$movie = new Movie();
$movie->setTitle('The big short');
$movie->setDesc('Capitalism');
$movie->setRating(3);
$movie->setTags(['tc', 'wtf']);
print '<p>' . ($movie->save() ? "Saving successful" : "Saving unsuccessful") . '</p>';
$music = new Music();
$music->setTitle('Bravo Hits 666');
$music->setDesc('Diabolic Bullshit');
$music->setRating(1);
$music->setTags(['dnt']);
print '<p>' . ($music->save() ? "Saving successful" : "Saving unsuccessful") . '</p>';
开发者ID:xanobius,项目名称:how2web,代码行数:30,代码来源:testclass.php

示例6: testI18nWithRelations2

 public function testI18nWithRelations2()
 {
     MovieQuery::create()->deleteAll();
     $count = MovieQuery::create()->count();
     $this->assertEquals(0, $count, 'No movie before the test');
     ToyQuery::create()->deleteAll();
     $count = ToyQuery::create()->count();
     $this->assertEquals(0, $count, 'No toy before the test');
     ToyI18nQuery::create()->deleteAll();
     $count = ToyI18nQuery::create()->count();
     $this->assertEquals(0, $count, 'No i18n toys before the test');
     MovieI18nQuery::create()->deleteAll();
     $count = MovieI18nQuery::create()->count();
     $this->assertEquals(0, $count, 'No i18n movies before the test');
     $t = new Toy();
     $t->setLocale('en');
     $t->setName('My Name');
     $t->setLocale('fr');
     $t->setName('Mon Nom');
     $t->setLocale('en');
     $this->assertEquals('My Name', $t->getName());
     $t->setLocale('fr');
     $this->assertEquals('Mon Nom', $t->getName());
     $m = new Movie();
     $m->addToy($t);
     $m->save();
     $count = MovieQuery::create()->count();
     $this->assertEquals(1, $count, '1 movie');
     $count = ToyQuery::create()->count();
     $this->assertEquals(1, $count, '1 toy');
     $count = ToyI18nQuery::create()->count();
     $this->assertEquals(2, $count, '2 i18n toys');
     $count = MovieI18nQuery::create()->count();
     $this->assertEquals(0, $count, '0 i18n movies');
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:35,代码来源:I18nBehaviorObjectBuilderModifierTest.php

示例7: postAddMovie

 public function postAddMovie()
 {
     $movie = new Movie();
     $movie->title = Input::get('title');
     $movie->genre = Input::get('genre');
     $movie->year = Input::get('year');
     $movie->user_id = Auth::user()->id;
     # Try to add the user
     try {
         $movie->save();
     } catch (Exception $e) {
         return Redirect::to('/add-movie')->with('flash_message', 'New movie failed to create; please try again.')->withInput();
     }
     return Redirect::to('/browse-movies')->with('flash_message', 'New movie created successfully!');
 }
开发者ID:tylerrehm07,项目名称:csci-e15,代码行数:15,代码来源:MovieController.php

示例8: Movie

                $fecha = $datos[$i]['value'];
                break;
            case "embedUrl":
                $trailer = $datos[$i]['value'];
                break;
        }
    }
    //me inserta una nueva fila a la tabla Movie por asi decirlo. Esta tabla tiene los campos name, description....
    //la variable $name_mov tiene el nombre de la pelicula que quiero guardar
    $nueva_movie = new Movie();
    $nueva_movie->name = $name_mov;
    $nueva_movie->description = $description;
    $nueva_movie->director = $director;
    $nueva_movie->datePublished = $fecha;
    $nueva_movie->embedUrl = $trailer;
    $nueva_movie->save();
});
/* modificar  una película en concreto  */
$app->put('/movies/:id', function ($id) use($app) {
    //recoge los datos del body y me devuelve los datos en json
    //die($datos['template']['data]);
    $body = $app->request->getBody();
    //Esto me lo decofica de JSON a PHP
    $template = json_decode($body, true);
    //obtiene una arrary con las lineas del data del JSON que nosotros le pasamos.
    $datos = $template['template']['data'];
    //$name_mov, $email, $description
    $longitud = count($datos);
    for ($i = 0; $i < $longitud; $i++) {
        switch ($datos[$i]['name']) {
            case "name":
开发者ID:interfacesweb15-16,项目名称:s4_venus,代码行数:31,代码来源:movies.php

示例9: Movie

                break;
            case "datePublished":
                $datePublished = $arrayDatos['value'];
                break;
            case "embedUrl":
                $embedUrl = $arrayDatos['value'];
                break;
        }
    }
    $nueva_movies = new Movie();
    $nueva_movies['name'] = $name;
    $nueva_movies['description'] = $description;
    $nueva_movies['director'] = $director;
    $nueva_movies['datePublished'] = $datePublished;
    $nueva_movies['embedUrl'] = $embedUrl;
    $nueva_movies->save();
});
/* PUT MOVIE */
$app->put('/movies/:id', function ($id) use($app) {
    // codigo para peticiones PUT (creacion de items)
    $template = json_decode($app->request->getBody(), true);
    $datos = $template['template']['data'];
    // for each para los datos de las pelis
    foreach ($datos as $arrayDatos) {
        switch ($arrayDatos['name']) {
            case "name":
                $name = $arrayDatos['value'];
                break;
            case "description":
                $description = $arrayDatos['value'];
                break;
开发者ID:interfacesweb15-16,项目名称:s4_mercury,代码行数:31,代码来源:movies.php

示例10: wp_movie_ratings_management_page

function wp_movie_ratings_management_page()
{
    # DATABASE -> ADD A NEW MOVIE
    # Get title of the movie and save its rating in the database
    if (isset($_POST["action"]) && substr(strtolower($_POST["action"]), 0, 3) == "add") {
        $url = isset($_POST["url"]) ? wp_movie_ratings_utf8_raw_url_decode($_POST["url"]) : null;
        $rating = isset($_POST["rating"]) ? $_POST["rating"] : null;
        $title = isset($_POST["title"]) ? wp_movie_ratings_utf8_raw_url_decode($_POST["title"]) : "";
        $review = isset($_POST["review"]) ? wp_movie_ratings_utf8_raw_url_decode($_POST["review"]) : "";
        $replacement_url = isset($_POST["replacement_url"]) ? wp_movie_ratings_utf8_raw_url_decode($_POST["replacement_url"]) : "";
        $watched_on = isset($_POST["watched_on"]) ? wp_movie_ratings_utf8_raw_url_decode($_POST["watched_on"]) : null;
        $movie = new Movie($url, $rating, $review, $title, $replacement_url, $watched_on);
        $msg = $movie->parse_rating();
        if (empty($msg)) {
            if (!empty($url)) {
                $msg = $movie->parse_imdb_url();
            }
            # fetch title from imdb
            if (empty($msg) && empty($title) && !empty($url)) {
                $msg = $movie->get_title();
            }
            # save new movie rating in the database
            if (empty($msg)) {
                $msg = $movie->save();
            }
        }
        echo wp_movie_ratings_utf8_raw_url_decode($msg);
        $m = new Movie();
        # new 'empty' movie object
    }
    # DATABASE -> DELETE MOVIE
    if (isset($_POST["action"]) && substr(strtolower($_POST["action"]), 0, 6) == "delete") {
        $mm = new Movie();
        $movie = $mm->get_movie_by_id($_POST["id"]);
        if ($movie != null) {
            echo $movie->delete();
        } else {
            echo '<div id="message" class="error fade"><p><strong>Error: no movie review to delete.</strong></p></div>';
        }
    }
    # DATABASE -> UPDATE MOVIE DATA
    if (isset($_POST["action"]) && substr(strtolower($_POST["action"]), 0, 6) == "update") {
        $movie = new Movie();
        $m = $movie->get_movie_by_id($_POST["id"]);
        if (isset($_POST["url"]) && isset($_POST["title"]) && isset($_POST["rating"]) && isset($_POST["review"]) && isset($_POST["replacement_url"]) && isset($_POST["watched_on"])) {
            echo $m->update_from_post();
        }
    }
    # EDIT MOVIE
    if (isset($_POST["action"]) && $_POST["action"] == "edit" || isset($_GET["action"]) && $_GET["action"] == "edit" && !isset($_POST["action"])) {
        $movie = new Movie();
        $id = isset($_POST["id"]) ? $_POST["id"] : (isset($_GET["id"]) ? $_GET["id"] : 0);
        $m = $movie->get_movie_by_id($id);
        $dialog_title = "Edit";
        $action = "Update";
        if ($m == null) {
            echo '<div id="message" class="error fade"><p><strong>Error: movie review not found.</strong></p></div>';
        }
    } else {
        # ADD MOVIE
        $dialog_title = "Add a new";
        $action = "Add a new";
        $m = new Movie(null, 7);
        # new 'empty' movie object (7 is the default rating)
    }
    $dialog_title .= " movie rating";
    ?>

<div class="wrap">
<h2><?php 
    echo $dialog_title;
    ?>
</h2>

<?php 
    if ($m != null) {
        $m->show_add_edit_form($action);
    }
    wp_movie_ratings_show(20, array("text_ratings" => "yes", "include_review" => "no", "sidebar_mode" => "no"));
    ?>

<p>If you'd like to edit earlier movie reviews you need to create a <a href="http://pawelgoscicki.com/projects/wp-movie-ratings/#installation">movie reviews page</a> and click (while being logged in) on the small 'e' link next to the movie title.</p>

<?php 
    wp_movie_ratings_show_statistics("detailed");
    ?>

<h2>Bookmarklet</h2>

<p>Add the following link to your Bookmarklets folder so you can rate your movies without visiting Wordpress administration page. You must be <strong>logged in</strong> to your Wordpress blog for it to work, though.</p>
<p><a href="javascript:(function(){open('<?php 
    echo wp_movie_ratings_get_plugin_path("absolute");
    ?>
add_movie.html?url='+escape(location.href),'<?php 
    echo basename(__FILE__, ".php");
    ?>
','toolbar=no,width=432,height=335')})()" title="Add movie rating bookmarklet">Add movie rating bookmarklet</a></p>

</div>

//.........这里部分代码省略.........
开发者ID:pjg,项目名称:wp_movie_ratings,代码行数:101,代码来源:wp_movie_ratings.php

示例11: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $time = time();
     $name = Input::get('name');
     $year = Input::get('year');
     $director = Input::get('director');
     $writer = Input::get('writer');
     $stars = Input::get('stars');
     $outline = Input::get('outline');
     $story = Input::get('story');
     $genre = Input::get('genre');
     $release = Input::get('release');
     $rating = Input::get('rating');
     $duration = Input::get('duration');
     $country = Input::get('country');
     $chars = preg_replace('/[^a-zA-Z0-9\\s]/', '', $name);
     // Removes special chars.
     $space = str_replace(' ', '', $chars);
     // Replaces all spaces
     $tags = $name . ', ' . $chars . ', ' . $space;
     $image_name = '';
     if (Input::hasFile('image')) {
         $original = Input::file('image')->getClientOriginalName();
         $image_name = $time . "_" . $original;
         $destinationPath = 'public/uploads/movie/' . $year . '/';
         if (Input::file('image')->move($destinationPath, $image_name)) {
         }
     }
     $rev = new Movie();
     $rev->fl_name = $name;
     $rev->fl_year = $year;
     $rev->fl_dir_ar_id = $director;
     $rev->fl_writer = $writer;
     $rev->fl_stars = $stars;
     $rev->fl_outline = $outline;
     $rev->fl_story = $story;
     $rev->fl_genre = $genre;
     $rev->fl_releasedate = $release;
     $rev->fl_rating = $rating;
     $rev->fl_tags = $tags;
     $rev->fl_duration = $duration;
     $rev->fl_country = $country;
     $rev->fl_status = '1';
     $rev->fl_image = $image_name;
     $rev->save();
 }
开发者ID:palhimanshu1991,项目名称:berdict,代码行数:51,代码来源:MoviesController.php

示例12: createMovie

 /**
  * Creates a new movie in database.
  * Used in /movie/actions/executeRefreshMovieCollection
  *
  * @param String $movie_title ex: Star Wars.mkv
  * @param String $movie_rel_filename ex: Star Wars.mkv
  */
 public static function createMovie($movie_title, $movie_rel_filename, $user)
 {
     $movie_object = Doctrine::getTable('Movie')->findOneByTitle($movie_title);
     $settings = Doctrine_Core::getTable('Settings')->findOneByUserId($user);
     //if new let's create it
     if ($movie_object == NULL) {
         $movie_object = new Movie();
         $movie_object->title = $movie_title;
         $movie_object->cover_index = 'NULL';
         $movie_object->cover_show = 'NULL';
     }
     $movie_object->file_abs = Util::makePath(array($settings['movies_root'], utf8_encode($movie_rel_filename)));
     $movie_object->file_rel = Util::changePathSeparators(Util::makeURLPath(array($settings['movies_root_rel'], utf8_encode($movie_rel_filename))));
     $movie_object->save();
 }
开发者ID:nass600,项目名称:homeCENTER,代码行数:22,代码来源:util.php


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