本文整理汇总了PHP中Movie::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Movie::getId方法的具体用法?PHP Movie::getId怎么用?PHP Movie::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Movie
的用法示例。
在下文中一共展示了Movie::getId方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public function save(Movie $movie)
{
$commentData = array('mov_id' => $movie->getcategory()->getId(), 'mov_description_short' => $movie->getMovie());
if ($movie->getId()) {
$this->getDb()->update('movie', $movieData, array('mov_id' => $movie->getId()));
} else {
$this->getDb()->insert('mov', $movieData);
$id = $this->getDb()->lastInsertId();
$movie->setId($id);
}
}
示例2: addInstanceToPool
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doSelect*()
* methods in your stub classes -- you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param Movie $value A Movie object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(Movie $obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
}
// if key === null
self::$instances[$key] = $obj;
}
}
示例3: setMovie
/**
* Declares an association between this object and a Movie object.
*
* @param Movie $v
* @return MovieI18n The current object (for fluent API support)
* @throws PropelException
*/
public function setMovie(Movie $v = null)
{
if ($v === null) {
$this->setId(NULL);
} else {
$this->setId($v->getId());
}
$this->aMovie = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already been added to the Movie object, it will not be re-added.
if ($v !== null) {
$v->addMovieI18n($this);
}
return $this;
}
示例4: prune
/**
* Exclude object from result
*
* @param Movie $movie Object to remove from the list of results
*
* @return MovieQuery The current query, for fluid interface
*/
public function prune($movie = null)
{
if ($movie) {
$this->addUsingAlias(MoviePeer::ID, $movie->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
示例5: filterByMovie
/**
* Filter the query by a related Movie object
*
* @param Movie|PropelCollection $movie The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return MoviesgenresQuery The current query, for fluid interface
*/
public function filterByMovie($movie, $comparison = null)
{
if ($movie instanceof Movie) {
return $this->addUsingAlias(MoviesgenresPeer::MOVIEID, $movie->getId(), $comparison);
} elseif ($movie instanceof PropelCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(MoviesgenresPeer::MOVIEID, $movie->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByMovie() only accepts arguments of type Movie or PropelCollection');
}
}
示例6: getMovieTrackList
/**
* Gets movie tracks list to be played.
* Used in /movie/showSuccess
*
* @param Movie $movie
* @return Array $tracks_list
*/
public static function getMovieTrackList($movie)
{
$item = array();
$item['id'] = $movie->getId();
$item['cover'] = str_replace("'", ''', $movie->getCoverShow());
$item['title'] = str_replace("'", ''', $movie->getTitle());
foreach ($movie['AudioTracks'] as $track) {
$item2 = array();
$item2['code'] = $track['code'];
$item2['codec'] = $track['codec'];
$item2['flag'] = $track['flag'];
$item['audio_tracks'][] = $item2;
}
foreach ($movie['SubTracks'] as $track) {
$item2 = array();
$item2['label'] = $track['label'];
$item2['code'] = $track['code'];
$item2['flag'] = $track['flag'];
$item['sub_tracks'][] = $item2;
}
$item['file_rel'] = $movie->getFileRel();
$tracks_list[] = $item;
return $tracks_list;
}
示例7: updateMovie
public function updateMovie(Movie $movie)
{
$this->connect();
// disable auto commit, so that we can roll back bridge table deletes if
// the transaction fails in the second portion of the query
mysqli_autocommit($this->link, FALSE);
// first, we delete all records in the actor bridge table for the movie
$sqlDelete = "DELETE FROM actor WHERE movie_id = " . $movie->getId();
try {
if (mysqli_query($this->link, $sqlDelete)) {
// now that the bridge table is cleared out, update the movie
$movieId = $movie->getId();
$directorId = $movie->getDirector()->getId();
$title = "'" . mysqli_real_escape_string($this->link, $movie->getTitle()) . "'";
$releaseDate = "'" . $movie->getReleaseDate() . "'";
$synopsis = "'" . mysqli_real_escape_string($this->link, $movie->getSynopsis()) . "'";
$sqlUpdate = "UPDATE movie " . "SET director_id = {$directorId}, " . "title = {$title}, " . "release_date = {$releaseDate}, " . "submit_date = CURDATE(), " . "synopsis = {$synopsis} " . "WHERE id = {$movieId}";
if (mysqli_query($this->link, $sqlUpdate)) {
// alright, movie table is updated, now to re-enter the new
// actor list into the bridge table.
$callback = function ($person) use($movieId) {
if ($person instanceof Person) {
$personId = $person->getId();
return "({$movieId}, {$personId})";
} else {
return "";
}
};
$bridgePairs = array_map($callback, $movie->getActors());
$values = implode(", ", $bridgePairs);
$bridgeSql = "INSERT INTO actor (movie_id, people_id) VALUES {$values}";
$result = mysqli_query($this->link, $bridgeSql);
if ($result) {
// ok, movie is update, and bridge table too
// now we can safely commit
mysqli_commit($this->link);
$this->disconnect();
return TRUE;
}
} else {
// uh oh, something went wrong, roll back and abort!
mysqli_rollback($this->link);
$this->disconnect();
return FALSE;
}
} else {
return FALSE;
}
} catch (Exception $e) {
mysqli_rollback($this->link);
$this->disconnect();
return FALSE;
}
}