本文整理汇总了PHP中Track::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Track::save方法的具体用法?PHP Track::save怎么用?PHP Track::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Track
的用法示例。
在下文中一共展示了Track::save方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addtrackAction
public function addtrackAction()
{
$form = new App_Form_NewTrack();
if (!empty($_POST) && $form->isValid($_POST)) {
$artists = new App_Table_Artist();
//--------------------------------
// Check the file info, and save
//--------------------------------
$track = new Track();
$track->title = $form->getValue('title');
$track->artistId = $this->_artist->id;
$track->releaseId = $form->getValue('releaseId');
$track->single = true;
$track->publishDate = $form->getValue('publishDate');
$track->save();
$this->_flash->addMessage('Your track info has been saved.');
$file = new TrackFile();
$file->trackId = $track->id;
$file->fileName = $form->audioFile->getFileName();
$file->mimeType = mime_content_type($file->fileName);
$file->save();
$track->originalFileId = $file->id;
$track->save();
$this->_flash->addMessage('The audio file for your track has been scheduled for injestion. Once the file has been injested, it will be available on the site.');
$form = new App_Form_NewTrack();
}
$form->setDefault('releaseId', $this->_request->getParam('releaseId'));
$form->setMethod('post');
$form->setAction('/dashboard/catalog/addtrack');
$this->view->form = $form;
}
示例2: track
/**
* store in db action
*
* @return array
*/
protected function track($action, $model, $id)
{
$track = new Track();
$track->auth_id = Auth::user()->id;
$track->date = new Datetime();
$track->action = $action;
$track->trackable_id = $id;
$track->trackable_type = $model;
return $track->save();
}
示例3: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$latitud = Input::get('latitud', 0);
$longitud = Input::get('longitud', 0);
// DB::table('tracks')->insert( array(
// 'latitud' => $latitud,
// 'longitud' => $longitud
// ));
$track = new Track();
$track->latitud = $latitud;
$track->longitud = $longitud;
$track->save();
$respuesta = array("state" => "ok", "message" => "todo ok");
// $personas = Persona::all();
return json_encode($respuesta);
}
示例4: doSave
/**
* Performs the work of inserting or updating the row in the database.
*
* If the object is new, it inserts it; otherwise an update is performed.
* All related objects are also updated in this method.
*
* @param PropelPDO $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @see save()
*/
protected function doSave(PropelPDO $con)
{
$affectedRows = 0;
// initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
// We call the save method on the following object(s) if they
// were passed to this object by their coresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
if ($this->aTrack !== null) {
if ($this->aTrack->isModified() || $this->aTrack->isNew()) {
$affectedRows += $this->aTrack->save($con);
}
$this->setTrack($this->aTrack);
}
if ($this->isNew()) {
$this->modifiedColumns[] = FilePeer::ID;
}
// If this object has been modified, then save it to the database.
if ($this->isModified()) {
if ($this->isNew()) {
$pk = FilePeer::doInsert($this, $con);
$affectedRows += 1;
// we are assuming that there is only 1 row per doInsert() which
// should always be true here (even though technically
// BasePeer::doInsert() can insert multiple rows).
$this->setId($pk);
//[IMV] update autoincrement primary key
$this->setNew(false);
} else {
$affectedRows += FilePeer::doUpdate($this, $con);
}
$this->resetModified();
// [HL] After being saved an object is no longer 'modified'
}
if ($this->collCollectionFiles !== null) {
foreach ($this->collCollectionFiles as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collFeaturevectors !== null) {
foreach ($this->collFeaturevectors as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collFeaturevectorsegments !== null) {
foreach ($this->collFeaturevectorsegments as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
$this->alreadyInSave = false;
}
return $affectedRows;
}
示例5: foreach
$start += $size;
$log->save(TRUE);
// SAVE TO DABATASE
$ok = 0;
$error = 0;
$log->add("saving {$xmlName} content to database...");
$result = $doc->getElementsByTagName("item");
// cada item corresponde a un album (o bundle en lenguaje netm)
if ($result->length > 0) {
// si tengo albums para recorrer
foreach ($result as $itemNumber => $xmlTrack) {
$xmlItem = $result->item($itemNumber);
if ($xmlItem->hasAttributes()) {
$track = new Track("brasil");
$track->setFromXML($xmlItem);
$saved = $track->save($dbc, "temas");
if ($saved === TRUE) {
// *************************
// OBTENGO DATOS DEL TRACK
$log->add("getting track id...");
$trackId = $track->getId();
// *************************
// *************************
// 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();
示例6: function
return Response::error('500');
}
});
Route::filter('auth', function () {
if (Auth::guest()) {
return Redirect::to('/');
}
});
Route::filter('Sentry_auth', function () {
if (Sentry::guest()) {
return Redirect::to('/');
}
});
Route::filter('ip', function () {
// Create the Eloquent object Visit
$visit = new Track();
$browser = new Browser();
$visit->location = Locate::get('city') . ', ' . Locate::get('state') . ', ' . Locate::get('country');
$visit->ip_address = Request::ip();
$visit->request = URI::current();
if (Auth::check()) {
$visit->user_id = Auth::user()->id;
}
// Browser stats
$visit->browser = $browser->getBrowser();
$visit->browser_version = $browser->getVersion();
$visit->platform = $browser->getPlatform();
$visit->mobile = $browser->isMobile();
$visit->robot = $browser->isRobot();
$visit->save();
});
示例7: doSave
/**
* Performs the work of inserting or updating the row in the database.
*
* If the object is new, it inserts it; otherwise an update is performed.
* All related objects are also updated in this method.
*
* @param PropelPDO $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @see save()
*/
protected function doSave(PropelPDO $con)
{
$affectedRows = 0;
// initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
// We call the save method on the following object(s) if they
// were passed to this object by their coresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
if ($this->aTrack !== null) {
if ($this->aTrack->isModified() || $this->aTrack->isNew()) {
$affectedRows += $this->aTrack->save($con);
}
$this->setTrack($this->aTrack);
}
if ($this->aFeaturevectortype !== null) {
if ($this->aFeaturevectortype->isModified() || $this->aFeaturevectortype->isNew()) {
$affectedRows += $this->aFeaturevectortype->save($con);
}
$this->setFeaturevectortype($this->aFeaturevectortype);
}
if ($this->aFile !== null) {
if ($this->aFile->isModified() || $this->aFile->isNew()) {
$affectedRows += $this->aFile->save($con);
}
$this->setFile($this->aFile);
}
// If this object has been modified, then save it to the database.
if ($this->isModified()) {
if ($this->isNew()) {
$pk = FeaturevectorPeer::doInsert($this, $con);
$affectedRows += 1;
// we are assuming that there is only 1 row per doInsert() which
// should always be true here (even though technically
// BasePeer::doInsert() can insert multiple rows).
$this->setNew(false);
} else {
$affectedRows += FeaturevectorPeer::doUpdate($this, $con);
}
// Rewind the data LOB column, since PDO does not rewind after inserting value.
if ($this->data !== null && is_resource($this->data)) {
rewind($this->data);
}
$this->resetModified();
// [HL] After being saved an object is no longer 'modified'
}
if ($this->collDistancesRelatedByTrackAId !== null) {
foreach ($this->collDistancesRelatedByTrackAId as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collDistancesRelatedByTrackBId !== null) {
foreach ($this->collDistancesRelatedByTrackBId as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collDistancejobs !== null) {
foreach ($this->collDistancejobs as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collFeaturevectorsegments !== null) {
foreach ($this->collFeaturevectorsegments as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
$this->alreadyInSave = false;
}
return $affectedRows;
}
示例8: createTrack
/**
* Creates or updates the track in database getting data from file.
* Used in /album/actions/executeRefreshAlbum
*
* @param Cd $cd_object ex: CD(Cd 1)
* @param Array $track_info[] ex: [3, Beat it, MICHAEL JACKSON, 4:32, 128 kbps, 3,4 MB]
* @return Track
*/
public static function createTrack($cd_object, $track_info)
{
//looking for this episode in db
$track_object = NULL;
foreach ($cd_object['Tracks'] as $track) {
if ($track->title == $track_info['title']) {
$track_object = $track;
}
}
//if there is no episode
if ($track_object == NULL) {
$track_object = new Track();
$track_object->title = $track_info['title'];
}
$track_object->num_track = $track_info['num_track'];
$track_object->duration = $track_info['duration'];
$track_object->bitrate = $track_info['bitrate'];
$track_object->filesize = $track_info['filesize'];
$track_object->rating = $track_info['rating'];
$track_object->lyrics = $track_info['lyrics'];
$track_object->file_rel = $track_info['file_rel'];
/********************************* YEAR *********************************/
if ($track_info['year'] == "") {
$track_object->Year = NULL;
} else {
$year_object = Doctrine::getTable('Year')->findOneByName($track_info['year']);
if ($year_object == NULL) {
$year_object = Util::createYear($track_info['year']);
}
$track_object->Year = $year_object;
}
/********************************* GENRE *********************************/
if ($track_info['genre'] == "") {
$track_object->Genre = NULL;
} else {
$genre_object = Doctrine::getTable('Genre')->findOneByName($track_info['genre']);
if ($genre_object == NULL) {
$genre_object = Util::createGenre($track_info['genre']);
}
$track_object->Genre = $genre_object;
}
/********************************* SINGER *********************************/
if ($track_info['artist'] == "") {
$track_object->Singer = NULL;
} else {
$singer_object = Doctrine::getTable('Singer')->findOneByName(Util::formatName($track_info['artist']));
if ($singer_object == NULL) {
$singer_object = Util::createSinger(Util::formatName($track_info['artist']));
}
$track_object->Singer = $singer_object;
}
$track_object->save();
$cd_object->Tracks[] = $track_object;
$cd_object->save();
return $track_object;
}