Ejemplo n.º 1
0
 /**
  * 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      Track $value A Track object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(Track $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
Ejemplo n.º 2
0
 /**
  * Declares an association between this object and a Track object.
  *
  * @param      Track $v
  * @return     File The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setTrack(Track $v = null)
 {
     if ($v === null) {
         $this->setTrackId(NULL);
     } else {
         $this->setTrackId($v->getId());
     }
     $this->aTrack = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Track object, it will not be re-added.
     if ($v !== null) {
         $v->addFile($this);
     }
     return $this;
 }
Ejemplo n.º 3
0
 /**
  * Save track.
  */
 function execute()
 {
     $schedConf =& Request::getSchedConf();
     $trackDao =& DAORegistry::getDAO('TrackDAO');
     if (isset($this->trackId)) {
         $track =& $trackDao->getTrack($this->trackId);
     }
     if (!isset($track)) {
         $track = new Track();
         $track->setSchedConfId($schedConf->getId());
         $track->setSequence(REALLY_BIG_NUMBER);
     }
     $track->setTitle($this->getData('title'), null);
     // Localized
     $track->setAbbrev($this->getData('abbrev'), null);
     // Localized
     $reviewFormId = $this->getData('reviewFormId');
     if ($reviewFormId === '') {
         $reviewFormId = null;
     }
     $track->setReviewFormId($reviewFormId);
     $track->setMetaReviewed($this->getData('metaNotReviewed') ? 0 : 1);
     $track->setIdentifyType($this->getData('identifyType'), null);
     // Localized
     $track->setDirectorRestricted($this->getData('directorRestriction') ? 1 : 0);
     $track->setPolicy($this->getData('policy'), null);
     // Localized
     $track->setHideAbout($this->getData('hideAbout'));
     $track->setDisableComments($this->getData('disableComments') ? 1 : 0);
     $track->setAbstractWordCount($this->getData('wordCount'));
     if ($track->getId() != null) {
         $trackDao->updateTrack($track);
         $trackId = $track->getId();
     } else {
         $trackId = $trackDao->insertTrack($track);
         $trackDao->resequenceTracks($schedConf->getId());
     }
     // Save assigned directors
     $trackDirectorsDao =& DAORegistry::getDAO('TrackDirectorsDAO');
     $trackDirectorsDao->deleteDirectorsByTrackId($trackId, $schedConf->getId());
     $directors = explode(':', Request::getUserVar('assignedDirectors'));
     foreach ($directors as $edUserId) {
         if (!empty($edUserId)) {
             $trackDirectorsDao->insertDirector($schedConf->getId(), $trackId, $edUserId);
         }
     }
 }
Ejemplo n.º 4
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();
                         $log->add("found artist={$artistId}");
                     } else {
                         $log->add("artist not found");
                         $log->add("saving new artist info...");
                         $artist->setName($track->getArtistName());