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


PHP Artist::save方法代码示例

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


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

示例1: afterUpdate

 public function afterUpdate($id, $data = null)
 {
     $artist = Artist::where('artistName', '=', $data['artist'])->where('ownerId', '=', Auth::user()->_id)->first();
     if ($artist == null) {
         $artist = new Artist();
     }
     $artist->artistName = $data['artist'];
     $artist->ownerId = Auth::user()->_id;
     $artist->ownerName = Auth::user()->firstname . ' ' . Auth::user()->lastname;
     $artist->save();
     return $id;
 }
开发者ID:awidarto,项目名称:tmadminflat,代码行数:12,代码来源:AlbumController.php

示例2: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Artist();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Artist'])) {
         $model->attributes = $_POST['Artist'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:hayao0,项目名称:Test,代码行数:17,代码来源:ArtistController.php

示例3: addArtist

 /**
  * Add an Artist to the database or get its key if it exists
  * @param name str: the name of the artist to add
  * @return     int: the primary key added or found
  */
 public function addArtist($name)
 {
     //is this name already in the collection?
     $q = Doctrine_Query::create()->select('a.id')->from('Artist a')->where('a.name = ?', $name);
     $result = $q->fetchOne();
     if (is_object($result) && $result->id > 0) {
         $retId = $result->id;
         unset($q, $result);
         return (int) $retId;
     } else {
         $item = new Artist();
         $item->name = $name;
         $item->save();
         $id = $item->getId();
         $item->free();
         unset($item, $q, $result);
         return (int) $id;
     }
 }
开发者ID:Alenpiera,项目名称:streeme,代码行数:24,代码来源:ArtistTable.class.php

示例4: array

						//Calls the getInfo function on the given artist
						$searchArtists = $apiClass->getPackage($auth, 'artist');
					    $searchResults=$searchArtists->getInfo($methodVars);
					    
					    if ($searchResults) {
							//If the search results are valid add the artist
							$db_artist = Doctrine_Query::create()
						        ->from('Artist a')
						        ->where('a.name=?', array(trim($artist)))
						        ->fetchOne();
						     if (!$db_artist) {
						     	//If we don't have it add it to the database'
								$db_artist = new Artist();
								$db_artist['name'] = trim($artist);
								$db_artist['added_by_user_id'] = $_SESSION['user']['user_id'];
								$db_artist->save();
						    }
						    //Link the artist to the album
						    $userartist = Doctrine_Query::create()
						        ->from('UserArtist a')
						        ->where('a.user_id=? and a.artist_id=?', array($_SESSION['user']['user_id'],$db_artist['artist_id']))
						        ->fetchOne();
					        if (!$userartist) {
					        	$userartist = new UserArtist();
					    		$userartist['user_id'] = $_SESSION['user']['user_id'];
					    		$userartist['artist_id'] = $db_artist['artist_id'];
					    		$userartist->save();
					        }
					        //add the album
								$db_album = Doctrine_Query::create()
							        ->from('Album a')
开发者ID:prismhdd,项目名称:victorioussecret,代码行数:31,代码来源:manual_add.php

示例5: Artist

 // *************************
 // *************************
 // OBTENGO DATOS DEL ARTISTA
 $log->add("getting artist id...");
 if ($trackId != NULL) {
     $artist = new Artist();
     $log->add("searching db for artist=" . $track->getArtistName());
     $artist->loadFromName($dbc, $track->getArtistName());
     if ($artist->getMaches() == "1") {
         $artistId = $artist->getId();
         $log->add("found artist={$artistId}");
     } else {
         $log->add("artist not found");
         $log->add("saving new artist info...");
         $artist->setName($track->getArtistName());
         $savedArtist = $artist->save($dbc, "artistas");
         if ($savedArtist == TRUE) {
             $artistId = $artist->getId();
             $log->add("new artist found={$artistId}...");
         } else {
             $artistId = NULL;
             $log->add("ERROR saving artist");
         }
     }
 }
 // *************************
 // *************************
 // OBTENGO DATOS DEL ALBUM
 $log->add("getting album id...");
 if ($artistId != NULL) {
     $album = new Album("brasil");
开发者ID:vallejos,项目名称:samples,代码行数:31,代码来源:sync-tracks.php

示例6: icons_in_post

 protected function icons_in_post($full_post)
 {
     $post = $full_post['.postmsg'][0];
     if (strpos($post->html(), '<img') === false) {
         return array();
     }
     $post_text = self::clean_up_post($post);
     $artist_name = $full_post['.postleft dt'][0]->text();
     $post_imgs = $post['img.postimg'];
     if (empty($post_imgs)) {
         return array();
     }
     $icons = self::find_icon_names_in_post($post_imgs, $post_text);
     $post_icons = array();
     foreach ($icons as $img_src => $name) {
         $icon = Make::an('Icon')->like('src', $img_src)->first();
         $changed = false;
         if (!$icon) {
             $icon = new Icon();
             $icon->src = $img_src;
             $icon->theme_id = $this->theme->id;
             // TODO: make this DRYer too
             if ($artist_name) {
                 $artist = Make::an('Artist')->like('name', $artist_name)->first();
                 if (!$artist) {
                     $artist = new Artist();
                     $artist->name = $artist_name;
                     $artist->save();
                 }
                 $icon->setArtist($artist);
             }
             $changed = true;
         }
         if ($name && !$icon->app()) {
             $app = Make::an('App')->like('name', $name)->first();
             if (!$app) {
                 $app = new App();
                 $app->name = $name;
                 $app->save();
             }
             $icon->setApp($app);
             $changed = true;
         }
         if ($changed) {
             $icon->save();
         }
         $post_icons[] = $icon;
     }
     /*
     		$matches = array();
     		$maybe_names = array();
     
     		if (preg_match('/(([a-z0-9\-]{2,}), )+([a-z0-9\- ]{2,})/i', $post_text, $matches)) {
     			$maybe_names = explode(',', $matches[0]); # [0] == entire match
     			$maybe_names = array_map('trim', $maybe_names);
     		} else {
     			$w = self::WORD_REGEXP;
     			$and_match = array();
     			if (preg_match('/'.$w.' and '.$w.'/iu', $post_text, $and_match)) {
     				$maybe_names = explode(' and ', $and_match[0]);
     				$maybe_names = array_map('trim', $maybe_names);
     			}
     		}
     
     		if ($maybe_names) {
     			foreach ($post_icons as &$post_icon) {
     				$post_icon->maybe_names = array_merge($post_icon->maybe_names, $maybe_names);
     			}
     		}
     */
     return $post_icons;
 }
开发者ID:ratz,项目名称:icon-harvester,代码行数:72,代码来源:ThemeController.class.php


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