/**
  * Returns all the tokens in this track
  *
  * @param boolean $refresh When true, always reload
  * @return array of \Gems_Tracker_Token
  */
 public function getTokens($refresh = false)
 {
     if (!$this->_tokens || $refresh) {
         if ($refresh) {
             $this->_firstToken = null;
         }
         $this->_tokens = array();
         $this->_activeTokens = array();
         $tokenSelect = $this->tracker->getTokenSelect();
         $tokenSelect->andReceptionCodes()->forRespondentTrack($this->_respTrackId);
         $tokenRows = $tokenSelect->fetchAll();
         $prevToken = null;
         foreach ($tokenRows as $tokenData) {
             $token = $this->tracker->getToken($tokenData);
             $this->_tokens[$token->getTokenId()] = $token;
             // While we are busy, set this
             if ($token->hasSuccesCode()) {
                 $this->_activeTokens[$token->getRoundId()] = $token;
             }
             // Link the tokens
             if ($prevToken) {
                 $prevToken->setNextToken($token);
             }
             $prevToken = $token;
         }
     }
     return $this->_tokens;
 }
 /**
  *
  * @param array $gemsData Optional, the data refresh with, otherwise refresh from database.
  * @return \Gems_Tracker_Token (continuation pattern)
  */
 public function refresh(array $gemsData = null)
 {
     if (is_array($gemsData)) {
         $this->_gemsData = $gemsData + $this->_gemsData;
     } else {
         $tokenSelect = $this->tracker->getTokenSelect();
         $tokenSelect->andReceptionCodes()->andRespondents()->andRespondentOrganizations()->andConsents()->forTokenId($this->_tokenId);
         $this->_gemsData = $tokenSelect->fetchRow();
         if (false == $this->_gemsData) {
             // on failure, reset to empty array
             $this->_gemsData = array();
         }
     }
     $this->exists = isset($this->_gemsData['gto_id_token']);
     return $this;
 }