本文整理汇总了PHP中Artist::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Artist::update方法的具体用法?PHP Artist::update怎么用?PHP Artist::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Artist
的用法示例。
在下文中一共展示了Artist::update方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testUpdateWithoutId
/**
* @covers Artist::update
*/
public function testUpdateWithoutId()
{
$artistDummy = $this->dummyArtistProvider();
$artistDummy->id = 'alpha';
$this->object->id = $artistDummy->id;
$this->object->name = $artistDummy->name;
$this->object->mbid = $artistDummy->mbid;
$this->assertFalse($this->object->update($error), 'Update should not be valid without valid id');
return $artistDummy;
}
示例2: Artist
$api->output(403, 'Admin scope is required for editing artist');
//indicate the requester do not have the required scope for updating artist
return;
}
if (!$api->checkParameterExists('id', $id)) {
$api->output(400, 'Artist identifier must be provided');
//artist was not provided, return an error
return;
}
$artist = new Artist($id);
if (!$artist->populate(['id' => $id])) {
$api->output(404, 'Artist not found');
//indicate the artist was not found
return;
}
//adapt and validate object received
$updatedArtist = $api->query['body'];
if (!$artist->validateModel($updatedArtist, $errorMessage)) {
$api->output(400, 'Artist is not valid: ' . $errorMessage);
//provided user is not valid
return;
}
if (!$artist->update($errorMessage)) {
$api->output(500, 'Error during artist update' . $errorMessage);
//something gone wrong :(
return;
}
$artist->getTracks();
$api->output(200, $artist->structureData());
break;
}
示例3: library_metadata
public static function library_metadata($params)
{
$r = Plex_XML_Data::createLibContainer();
$n = count($params);
$litem = null;
$createMode = $_SERVER['REQUEST_METHOD'] == 'POST';
$editMode = $_SERVER['REQUEST_METHOD'] == 'PUT';
if ($n > 0) {
$key = $params[0];
$id = Plex_XML_Data::getAmpacheId($key);
if ($editMode) {
self::check_access(50);
}
if ($n == 1) {
// Should we check that files still exists here?
$checkFiles = $_REQUEST['checkFiles'];
$extra = $_REQUEST['includeExtra'];
if (Plex_XML_Data::isArtist($key)) {
$litem = new Artist($id);
$litem->format();
if ($editMode) {
$dmap = array('title' => 'name', 'summary' => null);
$litem->update(self::get_data_from_map($dmap));
}
Plex_XML_Data::addArtist($r, $litem);
} elseif (Plex_XML_Data::isAlbum($key)) {
$litem = new Album($id);
$litem->format();
if ($editMode) {
$dmap = array('title' => 'name', 'year' => null);
$litem->update(self::get_data_from_map($dmap));
}
Plex_XML_Data::addAlbum($r, $litem);
} elseif (Plex_XML_Data::isTrack($key)) {
$litem = new Song($id);
$litem->format();
if ($editMode) {
$dmap = array('title' => null);
$litem->update(self::get_data_from_map($dmap));
}
Plex_XML_Data::addSong($r, $litem);
} elseif (Plex_XML_Data::isTVShow($key)) {
$litem = new TVShow($id);
$litem->format();
if ($editMode) {
$dmap = array('title' => 'name', 'year' => null, 'summary' => null);
$litem->update(self::get_data_from_map($dmap));
}
Plex_XML_Data::addTVShow($r, $litem);
} elseif (Plex_XML_Data::isTVShowSeason($key)) {
$litem = new TVShow_Season($id);
$litem->format();
Plex_XML_Data::addTVShowSeason($r, $litem);
} elseif (Plex_XML_Data::isVideo($key)) {
$litem = Video::create_from_id($id);
if ($editMode) {
$dmap = array('title' => null, 'year' => null, 'originallyAvailableAt' => 'release_date', 'originalTitle' => 'original_name', 'summary' => null);
$litem->update(self::get_data_from_map($dmap));
}
$litem->format();
$subtype = strtolower(get_class($litem));
if ($subtype == 'tvshow_episode') {
Plex_XML_Data::addEpisode($r, $litem, true);
} elseif ($subtype == 'movie') {
Plex_XML_Data::addMovie($r, $litem, true);
}
} elseif (Plex_XML_Data::isPlaylist($key)) {
$litem = new Playlist($id);
$litem->format();
if ($editMode) {
$dmap = array('title' => 'name');
$litem->update(self::get_data_from_map($dmap));
}
Plex_XML_Data::addPlaylist($r, $litem);
}
} else {
$subact = $params[1];
if ($subact == "children") {
if (Plex_XML_Data::isArtist($key)) {
$litem = new Artist($id);
$litem->format();
Plex_XML_Data::setArtistRoot($r, $litem);
} else {
if (Plex_XML_Data::isAlbum($key)) {
$litem = new Album($id);
$litem->format();
Plex_XML_Data::setAlbumRoot($r, $litem);
} else {
if (Plex_XML_Data::isTVShow($key)) {
$litem = new TVShow($id);
$litem->format();
Plex_XML_Data::setTVShowRoot($r, $litem);
} else {
if (Plex_XML_Data::isTVShowSeason($key)) {
$litem = new TVShow_Season($id);
$litem->format();
Plex_XML_Data::setTVShowSeasonRoot($r, $litem);
}
}
}
//.........这里部分代码省略.........
示例4: switch
switch ($_POST['type']) {
case 'album_row':
$key = 'album_' . $_POST['id'];
$album = new Album($_POST['id']);
$songs = $album->get_songs();
$new_id = $album->update($_POST);
if ($new_id != $_POST['id']) {
$album = new Album($new_id);
}
$album->format();
break;
case 'artist_row':
$key = 'artist_' . $_POST['id'];
$artist = new Artist($_POST['id']);
$songs = $artist->get_songs();
$new_id = $artist->update($_POST);
if ($new_id != $_POST['id']) {
$artist = new Artist($new_id);
}
$artist->format();
break;
case 'song_row':
$key = 'song_' . $_POST['id'];
$song = new Song($_POST['id']);
$song->update($_POST);
$song->format();
break;
case 'playlist_row':
case 'playlist_title':
$key = 'playlist_row_' . $_POST['id'];
if (isset($playlist)) {