src/QueryLog.php
public function register($additionalParameters = null)
    {
        if ($additionalParameters && !is_object($additionalParameters)) {
            throw new \Exception('additionalParameters must be an object');
        }

        //Ignore registration if disabled setting is set to true
        if (isset($this->settings->disabled) && $this->settings->disabled) {
            return false;
        }

        //Get current global adapter
        $internalAdapter = \Phramework\Database\Database::getAdapter();

        if (!$internalAdapter) {
            throw new \Exception('Global database adapter is not initialized');
        }

        //Create new QueryLogAdapter instance, using current global adapter
        $queryLogAdapter = new QueryLogAdapter(
            $this->settings,
            $internalAdapter,
            $additionalParameters
        );

        //Set newly created QueryLogAdapter instance as global adapter
        \Phramework\Database\Database::setAdapter($queryLogAdapter);

        return true;
    }
public function register($additionalParameters = null)
    {
        if ($additionalParameters && !is_object($additionalParameters)) {
            throw new \Exception('additionalParameters must be an object');
        }

        //Ignore registration if disabled setting is set to true
        if (isset($this->settings->disabled) && $this->settings->disabled) {
            return false;
        }

        //Get current global adapter
        $internalAdapter = \Phramework\Database\Database::getAdapter();

        if (!$internalAdapter) {
            throw new \Exception('Global database adapter is not initialized');
        }

        //Create new QueryLogAdapter instance, using current global adapter
        $queryLogAdapter = new QueryLogAdapter(
            $this->settings,
            $internalAdapter,
            $additionalParameters
        );

        //Set newly created QueryLogAdapter instance as global adapter
        \Phramework\Database\Database::setAdapter($queryLogAdapter);

        return true;
    }
public function register ( $ additionalParameters = null ) { if ( $ additionalParameters && ! is_object ( $ additionalParameters ) ) { throw new \ Exception ( 'additionalParameters must be an object' ) ; } //Ignore registration if disabled setting is set to true if ( isset ( $ this -> settings -> disabled ) && $ this -> settings -> disabled ) { return false ; } //Get current global adapter $ internalAdapter = \ Phramework \ Database \ Database :: getAdapter ( ) ; if ( ! $ internalAdapter ) { throw new \ Exception ( 'Global database adapter is not initialized' ) ; } //Create new QueryLogAdapter instance, using current global adapter $ queryLogAdapter = new QueryLogAdapter ( $ this -> settings , $ internalAdapter , $ additionalParameters ) ; //Set newly created QueryLogAdapter instance as global adapter \ Phramework \ Database \ Database :: setAdapter ( $ queryLogAdapter ) ; return true ; }
Activate query-log
@param null|object $additionalParameters
Additional parameters to be stored in query logs
@return boolean Returns false if query log is disabled
@throws \Exception
@uses Phramework\Database\Database
Activate query - log