code/dispatcher/behavior/limitable.php
protected function _beforeGet(DispatcherContext $context)
    {
        $controller = $this->getController();

        if($controller instanceof ControllerModellable)
        {
            $controller->getModel()->getState()->setProperty('limit', 'default', $this->getConfig()->default);

            $limit = $this->getRequest()->query->get('limit', 'int');

            // Set to default if there is no limit. This is done for both unique and non-unique states
            // so that limit can be transparently used on unique state requests rendering lists.
            if(empty($limit)) {
                $limit = $this->getConfig()->default;
            }

            if($this->getConfig()->max && $limit > $this->getConfig()->max) {
                $limit = $this->getConfig()->max;
            }

            $this->getRequest()->query->limit = $limit;
            $controller->getModel()->getState()->limit = $limit;
        }
    }
protected function _beforeGet(DispatcherContext $context)
    {
        $controller = $this->getController();

        if($controller instanceof ControllerModellable)
        {
            $controller->getModel()->getState()->setProperty('limit', 'default', $this->getConfig()->default);

            $limit = $this->getRequest()->query->get('limit', 'int');

            // Set to default if there is no limit. This is done for both unique and non-unique states
            // so that limit can be transparently used on unique state requests rendering lists.
            if(empty($limit)) {
                $limit = $this->getConfig()->default;
            }

            if($this->getConfig()->max && $limit > $this->getConfig()->max) {
                $limit = $this->getConfig()->max;
            }

            $this->getRequest()->query->limit = $limit;
            $controller->getModel()->getState()->limit = $limit;
        }
    }
protected function _beforeGet ( DispatcherContext $ context ) { $ controller = $ this -> getController ( ) ; if ( $ controller instanceof ControllerModellable ) { $ controller -> getModel ( ) -> getState ( ) -> setProperty ( 'limit' , 'default' , $ this -> getConfig ( ) -> default ) ; $ limit = $ this -> getRequest ( ) -> query -> get ( 'limit' , 'int' ) ; // Set to default if there is no limit. This is done for both unique and non-unique states // so that limit can be transparently used on unique state requests rendering lists. if ( empty ( $ limit ) ) { $ limit = $ this -> getConfig ( ) -> default ; } if ( $ this -> getConfig ( ) -> max && $ limit > $ this -> getConfig ( ) -> max ) { $ limit = $ this -> getConfig ( ) -> max ; } $ this -> getRequest ( ) -> query -> limit = $ limit ; $ controller -> getModel ( ) -> getState ( ) -> limit = $ limit ; } }
Sets a maximum and a default limit for GET requests

@param 	DispatcherContext $context The active command context
@return 	void
Sets a maximum and a default limit for GET requests