kernel/private/rest/classes/controllers/rest_controller.php
public function createResult()
    {
        $debug = ezpRestDebug::getInstance();
        $debug->startTimer( 'GeneratingRestResult', 'RestController' );

        if ( !self::$isCacheCreated )
        {
            ezcCacheManager::createCache(
                self::CACHE_ID,
                $this->getCacheLocation(),
                'ezpRestCacheStorageClusterObject',
                array( 'ttl' => $this->getActionTTL() )
            );
            self::$isCacheCreated = true;
        }

        $cache = ezcCacheManager::getCache( self::CACHE_ID );
        $controllerCacheId = $this->generateCacheId();
        $isCacheEnabled = $this->isCacheEnabled();

        // Try to restore application cache.
        // If expired or not yet available, generate it and store it
        $cache->isCacheEnabled = $isCacheEnabled;
        if ( ( $res = $cache->restore( $controllerCacheId ) ) === false )
        {
            try
            {
                $debug->log( 'Generating cache', ezcLog::DEBUG );
                $debug->switchTimer( 'GeneratingCache', 'GeneratingRestResult' );

                $res = parent::createResult();
                $resGroups = $this->getResponseGroups();
                if ( !empty( $resGroups ) )
                {
                    $res->variables['requestedResponseGroups'] = $resGroups;
                }

                if ( $res instanceof ezpRestMvcResult )
                {
                    $res->responseGroups = $resGroups;
                }

                if ( $isCacheEnabled )
                    $cache->store( $controllerCacheId, $res );

                $debug->stopTimer( 'GeneratingCache' );
            }
            catch ( Exception $e )
            {
                $debug->log( 'Exception caught, aborting cache generation', ezcLog::DEBUG );
                if ( $isCacheEnabled )
                    $cache->abortCacheGeneration();
                throw $e;
            }
        }

        // Add debug infos to output if debug is enabled
        $debug->stopTimer( 'GeneratingRestResult' );
        if ( ezpRestDebug::isDebugEnabled() )
        {
            $res->variables['debug'] = $debug->getReport();
        }

        return $res;
    }
public function createResult()
    {
        $debug = ezpRestDebug::getInstance();
        $debug->startTimer( 'GeneratingRestResult', 'RestController' );

        if ( !self::$isCacheCreated )
        {
            ezcCacheManager::createCache(
                self::CACHE_ID,
                $this->getCacheLocation(),
                'ezpRestCacheStorageClusterObject',
                array( 'ttl' => $this->getActionTTL() )
            );
            self::$isCacheCreated = true;
        }

        $cache = ezcCacheManager::getCache( self::CACHE_ID );
        $controllerCacheId = $this->generateCacheId();
        $isCacheEnabled = $this->isCacheEnabled();

        // Try to restore application cache.
        // If expired or not yet available, generate it and store it
        $cache->isCacheEnabled = $isCacheEnabled;
        if ( ( $res = $cache->restore( $controllerCacheId ) ) === false )
        {
            try
            {
                $debug->log( 'Generating cache', ezcLog::DEBUG );
                $debug->switchTimer( 'GeneratingCache', 'GeneratingRestResult' );

                $res = parent::createResult();
                $resGroups = $this->getResponseGroups();
                if ( !empty( $resGroups ) )
                {
                    $res->variables['requestedResponseGroups'] = $resGroups;
                }

                if ( $res instanceof ezpRestMvcResult )
                {
                    $res->responseGroups = $resGroups;
                }

                if ( $isCacheEnabled )
                    $cache->store( $controllerCacheId, $res );

                $debug->stopTimer( 'GeneratingCache' );
            }
            catch ( Exception $e )
            {
                $debug->log( 'Exception caught, aborting cache generation', ezcLog::DEBUG );
                if ( $isCacheEnabled )
                    $cache->abortCacheGeneration();
                throw $e;
            }
        }

        // Add debug infos to output if debug is enabled
        $debug->stopTimer( 'GeneratingRestResult' );
        if ( ezpRestDebug::isDebugEnabled() )
        {
            $res->variables['debug'] = $debug->getReport();
        }

        return $res;
    }
public function createResult ( ) { $ debug = ezpRestDebug :: getInstance ( ) ; $ debug -> startTimer ( 'GeneratingRestResult' , 'RestController' ) ; if ( ! self :: $ isCacheCreated ) { ezcCacheManager :: createCache ( self :: CACHE_ID , $ this -> getCacheLocation ( ) , 'ezpRestCacheStorageClusterObject' , array ( 'ttl' => $ this -> getActionTTL ( ) ) ) ; self :: $ isCacheCreated = true ; } $ cache = ezcCacheManager :: getCache ( self :: CACHE_ID ) ; $ controllerCacheId = $ this -> generateCacheId ( ) ; $ isCacheEnabled = $ this -> isCacheEnabled ( ) ; // Try to restore application cache. // If expired or not yet available, generate it and store it $ cache -> isCacheEnabled = $ isCacheEnabled ; if ( ( $ res = $ cache -> restore ( $ controllerCacheId ) ) === false ) { try { $ debug -> log ( 'Generating cache' , ezcLog :: DEBUG ) ; $ debug -> switchTimer ( 'GeneratingCache' , 'GeneratingRestResult' ) ; $ res = parent :: createResult ( ) ; $ resGroups = $ this -> getResponseGroups ( ) ; if ( ! empty ( $ resGroups ) ) { $ res -> variables [ 'requestedResponseGroups' ] = $ resGroups ; } if ( $ res instanceof ezpRestMvcResult ) { $ res -> responseGroups = $ resGroups ; } if ( $ isCacheEnabled ) $ cache -> store ( $ controllerCacheId , $ res ) ; $ debug -> stopTimer ( 'GeneratingCache' ) ; } catch ( Exception $ e ) { $ debug -> log ( 'Exception caught, aborting cache generation' , ezcLog :: DEBUG ) ; if ( $ isCacheEnabled ) $ cache -> abortCacheGeneration ( ) ; throw $ e ; } } // Add debug infos to output if debug is enabled $ debug -> stopTimer ( 'GeneratingRestResult' ) ; if ( ezpRestDebug :: isDebugEnabled ( ) ) { $ res -> variables [ 'debug' ] = $ debug -> getReport ( ) ; } return $ res ; }
Override to add the "requestedResponseGroups" variable for every REST requests

@see lib/ezc/MvcTools/src/interfaces/ezcMvcController::createResult()
Override to add the requestedResponseGroups variable for every REST requests