Git Product home page Git Product logo

Comments (4)

andrey-mokhov avatar andrey-mokhov commented on August 29, 2024 1

for ZF3 can use:

composer require andrey-mokhov/bjy-profiler:dev-master

from bjyprofiler.

andrey-mokhov avatar andrey-mokhov commented on August 29, 2024 1

see Zend\Db\ConfigProvider (zend-db 2.8), Zend\Db\Adapter\Adapter is an alias for Zend\Db\Adapter\AdapterInterface
change your config as:

 'service_manager' => [
        'factories' => [
            \Zend\Db\Adapter\AdapterInterface::class => function ($sm) {

from bjyprofiler.

Sohorev avatar Sohorev commented on August 29, 2024

How to configure profiler?
In my application.config.php I am added following configuration:

    'service_manager' => [
        'factories' => [
            \Zend\Db\Adapter\Adapter::class => function ($sm) {
                $adapter = new BjyProfiler\Db\Adapter\ProfilingAdapter(array(
                    'driver'    => 'Zend\Db\Adapter\Driver\Pgsql\Pgsql',
                    'dsn'       => 'pgsql:dbname=' . QP_MAIN_DB_BASE_NAME . ';host='.QP_MAIN_DB_HOST,
                    'database'  => QP_MAIN_DB_BASE_NAME,
                    'username'  => QP_MAIN_DB_USER_NAME,
                    'password'  => QP_MAIN_DB_PASSWORD,
                    'hostname'  => QP_MAIN_DB_HOST,
                ));
                if (php_sapi_name() == 'cli') {
                    $logger = new Zend\Log\Logger();
                    // write queries profiling info to stdout in CLI mode
                    $writer = new Zend\Log\Writer\Stream('php://output');
                    $logger->addWriter($writer, Zend\Log\Logger::DEBUG);
                    $adapter->setProfiler(new BjyProfiler\Db\Profiler\LoggingProfiler($logger));
                } else {
                    $adapter->setProfiler(new BjyProfiler\Db\Profiler\Profiler());
                }
                if (isset($dbParams['options']) && is_array($dbParams['options'])) {
                    $options = $dbParams['options'];
                } else {
                    $options = array();
                }
                $adapter->injectProfilingStatementPrototype($options);
                return $adapter;
            },
        ],

But: $this->_container->get('Zend\Db\Adapter\Adapter')->getProfiler()
returning null

from bjyprofiler.

Sohorev avatar Sohorev commented on August 29, 2024

Thankyou! It is works
Also code:

 'service_manager' => [
        'factories' => [
            \Zend\Db\Adapter\AdapterInterface::class => function ($sm) {

I has moved from application.config.php to module.config.php in any module.

from bjyprofiler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.