public function beforeFind(Event $event)
    {
        //Inject default query handlers
        $queryParameters = Hash::merge($this->getConfig('queryParameters'), [
            'sort' => [
                'callable' => [$this, '_sortParameter'],
            ],
            'include' => [
                'callable' => [$this, '_includeParameter']
            ],
            'fields' => [
                'callable' => [$this, '_fieldSetsParameter']
            ]
        ]);

        foreach ($queryParameters as $parameter => $options) {
            if (is_callable($options)) {
                $options = [
                    'callable' => $options
                ];
            }

            if (!is_callable($options['callable'])) {
                throw new \InvalidArgumentException('Invalid callable supplied for query parameter ' . $parameter);
            }

            $options['callable']($this->_request()->getQuery($parameter), $event->getSubject(), $options);
        }
    }
public function beforeFind(Event $event)
    {
        //Inject default query handlers
        $queryParameters = Hash::merge($this->getConfig('queryParameters'), [
            'sort' => [
                'callable' => [$this, '_sortParameter'],
            ],
            'include' => [
                'callable' => [$this, '_includeParameter']
            ],
            'fields' => [
                'callable' => [$this, '_fieldSetsParameter']
            ]
        ]);

        foreach ($queryParameters as $parameter => $options) {
            if (is_callable($options)) {
                $options = [
                    'callable' => $options
                ];
            }

            if (!is_callable($options['callable'])) {
                throw new \InvalidArgumentException('Invalid callable supplied for query parameter ' . $parameter);
            }

            $options['callable']($this->_request()->getQuery($parameter), $event->getSubject(), $options);
        }
    }
public function beforeFind ( Event $ event ) { //Inject default query handlers $ queryParameters = Hash :: merge ( $ this -> getConfig ( 'queryParameters' ) , [ 'sort' => [ 'callable' => [ $ this , '_sortParameter' ] , ] , 'include' => [ 'callable' => [ $ this , '_includeParameter' ] ] , 'fields' => [ 'callable' => [ $ this , '_fieldSetsParameter' ] ] ] ) ; foreach ( $ queryParameters as $ parameter => $ options ) { if ( is_callable ( $ options ) ) { $ options = [ 'callable' => $ options ] ; } if ( ! is_callable ( $ options [ 'callable' ] ) ) { throw new \ InvalidArgumentException ( 'Invalid callable supplied for query parameter ' . $ parameter ) ; } $ options [ 'callable' ] ( $ this -> _request ( ) -> getQuery ( $ parameter ) , $ event -> getSubject ( ) , $ options ) ; } }
BeforeFind event listener to parse any supplied query parameters

@param \Cake\Event\Event $event Event
@return void
BeforeFind event listener to parse any supplied query parameters