public function getActiveRoundToken($roundId, \Gems_Tracker_Token $token = null)
    {
        if ((null !== $token) && $token->hasSuccesCode()) {
            // Cache the token
            //
            // WARNING: This may cause bugs for tracks where two tokens exists
            // with this roundId and a success reception code, but this does speed
            // this function with track engines where that should not occur.
            $this->_activeTokens[$token->getRoundId()] = $token;
        }

        // Nothing to find
        if (! $roundId) {
            return null;
        }

        // Use array_key_exists since there may not be a valid round
        if (! array_key_exists($roundId, $this->_activeTokens)) {
            $tokenSelect = $this->tracker->getTokenSelect();
            $tokenSelect->andReceptionCodes()
                    ->forRespondentTrack($this->_respTrackId)
                    ->forRound($roundId)
                    ->onlySucces();

            // \MUtil_Echo::track($tokenSelect->__toString());

            if ($tokenData = $tokenSelect->fetchRow()) {
                $this->_activeTokens[$roundId] = $this->tracker->getToken($tokenData);
            } else {
                $this->_activeTokens[$roundId] = null;
            }
        }

        return $this->_activeTokens[$roundId];
    }
public function getActiveRoundToken($roundId, \Gems_Tracker_Token $token = null)
    {
        if ((null !== $token) && $token->hasSuccesCode()) {
            // Cache the token
            //
            // WARNING: This may cause bugs for tracks where two tokens exists
            // with this roundId and a success reception code, but this does speed
            // this function with track engines where that should not occur.
            $this->_activeTokens[$token->getRoundId()] = $token;
        }

        // Nothing to find
        if (! $roundId) {
            return null;
        }

        // Use array_key_exists since there may not be a valid round
        if (! array_key_exists($roundId, $this->_activeTokens)) {
            $tokenSelect = $this->tracker->getTokenSelect();
            $tokenSelect->andReceptionCodes()
                    ->forRespondentTrack($this->_respTrackId)
                    ->forRound($roundId)
                    ->onlySucces();

            // \MUtil_Echo::track($tokenSelect->__toString());

            if ($tokenData = $tokenSelect->fetchRow()) {
                $this->_activeTokens[$roundId] = $this->tracker->getToken($tokenData);
            } else {
                $this->_activeTokens[$roundId] = null;
            }
        }

        return $this->_activeTokens[$roundId];
    }
public function getActiveRoundToken ( $ roundId , \ Gems_Tracker_Token $ token = null ) { if ( ( null !== $ token ) && $ token -> hasSuccesCode ( ) ) { // Cache the token // // WARNING: This may cause bugs for tracks where two tokens exists // with this roundId and a success reception code, but this does speed // this function with track engines where that should not occur. $ this -> _activeTokens [ $ token -> getRoundId ( ) ] = $ token ; } // Nothing to find if ( ! $ roundId ) { return null ; } // Use array_key_exists since there may not be a valid round if ( ! array_key_exists ( $ roundId , $ this -> _activeTokens ) ) { $ tokenSelect = $ this -> tracker -> getTokenSelect ( ) ; $ tokenSelect -> andReceptionCodes ( ) -> forRespondentTrack ( $ this -> _respTrackId ) -> forRound ( $ roundId ) -> onlySucces ( ) ; // \MUtil_Echo::track($tokenSelect->__toString()); if ( $ tokenData = $ tokenSelect -> fetchRow ( ) ) { $ this -> _activeTokens [ $ roundId ] = $ this -> tracker -> getToken ( $ tokenData ) ; } else { $ this -> _activeTokens [ $ roundId ] = null ; } } return $ this -> _activeTokens [ $ roundId ] ; }
Returns a token with a success reception code for this round or null

@param type $roundId Gems round id
@param \Gems_Tracker_Token $token Optional token to add as a round (for speed optimization)
@return \Gems_Tracker_Token
Returns a token with a success reception code for this round or null