コード例 #1
0
 static function newAlbum($profile_id, $album_name, $album_description)
 {
     //TODO: Should use foreign key instead...
     if (!Profile::getKV('id', $profile_id)) {
         //Is this a bit extreme?
         throw new ServerException(_m('No such user exists with id ' . $profile_id . ', couldn\'t create album.'));
     }
     $album = new GNUsocialPhotoAlbum();
     $album->profile_id = $profile_id;
     $album->album_name = $album_name;
     $album->album_description = $album_description;
     $album->album_id = $album->insert();
     if (!$album->album_id) {
         common_log_db_error($album, 'INSERT', __FILE__);
         throw new ServerException(_m('Error creating new album.'));
     }
     common_log(LOG_INFO, 'album_id : ' . $album->album_id);
     return $album;
 }