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


PHP Movie::setId方法代码示例

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


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

示例1: getMoviesFromDb

 public function getMoviesFromDb($columnsNames = ["id", "name", "description", "rating"])
 {
     if (is_array($columnsNames) && !empty($columnsNames)) {
         $columns = implode(",", $columnsNames);
         $sqlQuery = "SELECT " . $columns . " FROM movies";
         $conn = parent::getConnection();
         $result = $conn->query($sqlQuery);
         if ($result->num_rows > 0) {
             while ($row = $result->fetch_assoc()) {
                 $movie = new Movie(parent::getConnection());
                 if (array_key_exists("id", $row)) {
                     $movie->setId($row["id"]);
                 }
                 if (array_key_exists("name", $row)) {
                     $movie->setName($row["name"]);
                 }
                 if (array_key_exists("description", $row)) {
                     $movie->setDescription($row["description"]);
                 }
                 if (array_key_exists("rating", $row)) {
                     $movie->setRating($row["rating"]);
                 }
                 $this->setArrayWithMovies($movie);
             }
         }
     }
 }
开发者ID:Witoso,项目名称:cinema_app,代码行数:27,代码来源:MovieFetcher.php

示例2: buildDomainObject

 protected function buildDomainObject($row)
 {
     $movie = new Movie();
     $movie->setId($row['mov_id']);
     $movie->setTitle($row['mov_title']);
     $movie->setDescriptionS($row['mov_description_short']);
     return $movie;
 }
开发者ID:DorianeV,项目名称:MyMovies,代码行数:8,代码来源:MovieDAO.php

示例3: buildDomainObject

 protected function buildDomainObject($row)
 {
     $movie = new Movie();
     $movie->setId($row['mov_id']);
     $movie->setContent($row['mov_description_short']);
     if (array_key_exists('cat_id', $row)) {
         // Find and set the associated category
         $categoryId = $row['cat_id'];
         $category = $this->categoryDAO->find($categoryId);
         $movie->setcategory($category);
     }
     return $movie;
 }
开发者ID:DorianeV,项目名称:MyMovies,代码行数:13,代码来源:CategoryDAO.php

示例4: buildDomainObject

 protected function buildDomainObject($row)
 {
     $movie = new Movie();
     $movie->setId($row['mov_id']);
     $movie->setTitle($row['mov_title']);
     $movie->setDecriptionShort($row['mov_description_short']);
     $movie->setDecriptionLong($row['mov_description_long']);
     $movie->setDirector($row['mov_director']);
     $movie->setYear($row['mov_year']);
     $movie->setImage($row['mov_image']);
     if (array_key_exists('id_categorie', $row)) {
         $categoryID = $row['cat_id'];
         $category = $this->categoryDAO->find($categoryId);
         $movie->setCategory($category);
     }
     return $movie;
 }
开发者ID:ilakkiya12,项目名称:myMovies,代码行数:17,代码来源:MovieDAO.php

示例5: Movie

    $movie = new Movie($db);
    $selected = substr($_POST['update_title'], 1, -1);
    $movie->setId($selected);
    $rows = $movie->find_movie_by_id();
    if (is_array($rows)) {
        try {
            $view = new View();
            $view->view_selected_movie($rows);
        } catch (Exception $e) {
            echo "Error: {$e->getMessage()}";
        }
    } else {
        throw new Exception("Error: Please contact the tech guys.");
    }
    $db = NULL;
}
if (isset($_POST['update_movie'])) {
    $db = new Database();
    $movie = new Movie($db);
    $selected = $_POST['movie_id'];
    $movie->setId($selected);
    $movie->setTitle($_POST['movie-title']);
    $movie->setDirector($_POST['movie-director']);
    $movie->setSynopsis($_POST['movie-synopsis']);
    $movie->setYear($_POST['movie-year']);
    $movie->setCountry($_POST['movie-country']);
    $movie->setDuration($_POST['movie-duration']);
    if ($movie->update_movie()) {
        echo "It works!";
    }
}
开发者ID:ireydiak,项目名称:whattowatch,代码行数:31,代码来源:update_admin.php

示例6: duplicateMovie

 public function duplicateMovie($id, $idUser)
 {
     $movie = null;
     $resultats = $this->bdd->prepare("SELECT * FROM movie WHERE mov_id=?;");
     $resultats->execute(array($id));
     $resultats->setFetchMode(PDO::FETCH_OBJ);
     while ($result = $resultats->fetch()) {
         $movie = new Movie($result->mov_id, $result->mov_user, $result->mov_title, $result->mov_description_short, $result->mov_description_long, $result->mov_director, $result->mov_year, $result->mov_image, $result->mov_cat);
     }
     $movie->setUser($idUser);
     $req2 = $this->bdd->prepare("INSERT INTO movie (mov_title, mov_user,mov_description_short, mov_description_long, mov_director, mov_year, mov_image, mov_cat) VALUES (:titre, :utilisateur, :resume, :synopsis, :realisateur, :annee, :affiche, :categorie)");
     $result2 = $req2->execute(array("titre" => htmlspecialchars($movie->getTitle()), "utilisateur" => htmlspecialchars($movie->getUser()), "resume" => htmlspecialchars($movie->getDescriptionShort()), "synopsis" => htmlspecialchars($movie->getDescriptionLong()), "realisateur" => htmlspecialchars($movie->getDirector()), "annee" => htmlspecialchars($movie->getYear()), "affiche" => htmlspecialchars($movie->getImage()), "categorie" => htmlspecialchars($movie->getCategory())));
     $movie->setId($this->bdd->lastInsertId());
     return $movie;
 }
开发者ID:polytechlyon-isi1web,项目名称:mymovies-corentinMar,代码行数:15,代码来源:movies_bd.php

示例7: match

    $vote = match('/<span itemprop="ratingCount">(.*)<\\/span>/', $htmlForVotes, 1);
    return $vote;
}
// match html from imdb
foreach (match_all('/<tr class="(even|odd)">(.*?)<\\/tr>/ms', $html, 2) as $m) {
    $rank++;
    $id = match('/<td class="titleColumn">.*?<a href="\\/title\\/(tt\\d+)\\/.*?"/msi', $m, 1);
    $title = match('/<td class="titleColumn">.*?<a.*?>(.*?)<\\/a>/msi', $m, 1);
    $year = match('/<td class="titleColumn">.*?<span.*?>\\((.*?)\\)<\\/span>/msi', $m, 1);
    $rating = match('/<td class="ratingColumn">.*?<strong.*?>(.*?)<\\/strong>/msi', $m, 1);
    $poster = match('/<td class="posterColumn">.*?<img src="(.*?)"/msi', $m, 1);
    $votesURL = "http://www.imdb.com/title/" . $id . "/";
    $votes = getvotes($votesURL);
    // create each movie object and set the variables
    $movie = new Movie();
    $movie->setId($id);
    $movie->setRank($rank);
    $movie->setTitle($title);
    $movie->setYear($year);
    $movie->setRating($rating);
    $movie->setVotes($votes);
    // insert $movie objects into an array
    array_push($top10Movies, $movie);
    // stop at 10
    if ($rank == 10) {
        break;
    }
}
$date = $db->select("movies", "date_added");
// insert into database using medoo if it does not exist
foreach ($top10Movies as $movie) {
开发者ID:abacaj,项目名称:IMDB-PHP-Parser,代码行数:31,代码来源:movies_script.php


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